llvm::SelectionDAGISel crash when using __builtin_copysign() with -march=armv8-a+nosimd
| Bugzilla Link | 51806 |
| Version | 12.0 |
| OS | All |
| Reporter | LLVM Bugzilla Contributor |
| CC | @Arnaud-de-Grandmaison-ARM,@DMG862,@fhahn,@LebedevRI,@RKSimon,@arsenm,@smithp35 |
Extended Description
See https://gcc.godbolt.org/z/917z95e7W
$ cat crash.c double crash(double a, double b) { return __builtin_copysign(a, b); }
$ clang -O2 -march=armv8-a+nosimd --target=arm64 -S crash.c -o /dev/null fatal error: error in backend: Cannot select: 0x7fae361bb4e8: v2i64 = AArch64ISD::BIT 0x7fae361bb210, 0x7fae361bb278, 0x7fae361bb480 ...
Others FP related builtins doesn't seem to have problems with nosimd.
So, I worked on the issue, I don't know why are you trying nosimd for armv8. armv8 doesn't support nosimd. armv7 supports it. you can rather use nofp if you want. Correct me if I am wrong. Furthermore, you can check the other options you can use here; https://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html
I think this is broken somewhere inside AArch64TargetLowering::LowerFCOPYSIGN
Given that its armv8-a+nosimd suggests some type/opcode legality is broken resulting in the AArch64ISD::BIT node being created.
I am trying to debug this error. I gone through https://llvm.org/docs/CodeGenerator.html It will be really helpful if I can get any suggestion for where to begin.
fixed by https://github.com/llvm/llvm-project/commit/6f61fe7de97c78adc8fac528239260122fb83be5