Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

crash mixing funny x86 sse flags #39422

Open Quuxplusone opened 5 years ago

Quuxplusone commented 5 years ago
Bugzilla Link PR40451
Status NEW
Importance P enhancement
Reported by Nick Desaulniers (ndesaulniers@google.com)
Reported on 2019-01-24 15:55:39 -0800
Last modified on 2019-01-24 16:29:59 -0800
Version trunk
Hardware PC Linux
CC craig.topper@gmail.com, llvm-bugs@lists.llvm.org, llvm-dev@redking.me.uk, neeilans@live.com, richard-llvm@metafoo.co.uk, rnk@google.com, spatel+llvm@rotateright.com
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also
Reproducer

// clang -c -O2 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -m64 -msse float.c
double div (double a, double b) {
  return b / a;
}

float.c:1:8: error: SSE2 register return with SSE2 disabled
double div (double a, double b) {
...
3.  Running pass 'Function Pass Manager' on module 'float.c'.
4.  Running pass 'X86 FP Stackifier' on function '@div'
...
/android0/llvm-project/llvm/build/bin/clang-9(llvm::MachineFunctionPass::runOnFunction(llvm::Function&)+0x217)[0x2cfd127]
/android0/llvm-project/llvm/build/bin/clang-9(llvm::FPPassManager::runOnFunction(llvm::Function&)+0x1f4)[0x31e8804]
Quuxplusone commented 5 years ago

We used to have a much harder error for this, but Reid softened the error in 2017 and attempted to recover. But it looks like we end up with a COPY from an xmm register to an x87 pseudo register used by the stackifier. We don't know how to support that.

Quuxplusone commented 5 years ago
This behaves even worse. It just crashes without the mention of SSE2 being
disabled.

void div (double a, double b, double *c) {
  *c = b / a;
}