Issue 172964
Summary [LoongArch] Assertion `getSignificantBits() <= 64 && "Too many bits for int64_t"' failed.
Labels crash-on-valid, backend:loongarch
Assignees
Reporter XChy
    Reproducer: https://godbolt.org/z/KTv13v8Wx
Reduced testcase from a C program with `_BitInt`:
```llvm
target datalayout = "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128"
target triple = "loongarch64-unknown-linux-musl"

define i1 @backsmith_pure_0(i104 %conv2, i64 %0) {
entry:
  %xor = xor i104 %conv2, 16938544400857032487
 %conv3 = zext i64 %0 to i104
  %and = and i104 %xor, %conv3
  %tobool = icmp ne i104 %and, 0
  ret i1 %tobool
}
```

Dump:
```
llc: /root/llvm-project/llvm/include/llvm/ADT/APInt.h:1566: int64_t llvm::APInt::getSExtValue() const: Assertion `getSignificantBits() <= 64 && "Too many bits for int64_t"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
Stack dump:
0.	Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/llc -o /app/output.s -x86-asm-syntax=intel <source>
1.	Running pass 'Function Pass Manager' on module '<source>'.
2.	Running pass 'LoongArch DAG->DAG Pattern Instruction Selection' on function '@backsmith_pure_0'
 #0 0x00000000041ecd68 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x41ecd68)
 #1 0x00000000041e9c14 llvm::sys::RunSignalHandlers() (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x41e9c14)
 #2 0x00000000041e9d8a SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #3 0x000074ab3f042520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x000074ab3f0969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #5 0x000074ab3f042476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #6 0x000074ab3f0287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #7 0x000074ab3f02871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #8 0x000074ab3f039e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
 #9 0x0000000000b6532e (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0xb6532e)
#10 0x000000000199c804 llvm::LoongArchTargetLowering::PerformDAGCombine(llvm::SDNode*, llvm::TargetLowering::DAGCombinerInfo&) const (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x199c804)
#11 0x0000000003e15adf (anonymous namespace)::DAGCombiner::combine(llvm::SDNode*) DAGCombiner.cpp:0:0
#12 0x0000000003e17560 (anonymous namespace)::DAGCombiner::Run(llvm::CombineLevel) DAGCombiner.cpp:0:0
#13 0x0000000003e19fb3 llvm::SelectionDAG::Combine(llvm::CombineLevel, llvm::BatchAAResults*, llvm::CodeGenOptLevel) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3e19fb3)
#14 0x0000000003f83899 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3f83899)
#15 0x0000000003f87128 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3f87128)
#16 0x0000000003f88c5c llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3f88c5c)
#17 0x0000000003f7464f llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3f7464f)
#18 0x00000000030dc7a9 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#19 0x0000000003728566 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3728566)
#20 0x0000000003728911 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3728911)
#21 0x000000000372917f llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x372917f)
#22 0x00000000008f7f4d compileModule(char**, llvm::SmallVectorImpl<llvm::PassPlugin>&, llvm::LLVMContext&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&) llc.cpp:0:0
#23 0x00000000007c164c main (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x7c164c)
#24 0x000074ab3f029d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#25 0x000074ab3f029e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#26 0x00000000008ecc25 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x8ecc25)
Program terminated with signal: SIGSEGV
Compiler returned: 139
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to