Issue 122580
Summary [X86][ISel] Assertion `(LZ + TZ) < Known.getBitWidth() && "Illegal shifted mask"' failed.
Labels backend:X86, crash-on-valid
Assignees
Reporter dtcxzyw
    Reproducer: https://godbolt.org/z/eqMMqPavq
```
; bin/llc reduced.ll -o -
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@g_180 = external global i8
@g_1032 = external global [2 x i32]

define i32 @test(ptr %0) {
entry:
  %.b577 = load i1, ptr @g_180, align 4
  %1 = select i1 %.b577, i32 1, i32 878456582
 store i32 0, ptr @g_1032, align 4
  %.b576 = load i1, ptr @g_180, align 4
 %2 = select i1 %.b576, i32 1, i32 878456582
  %or542.1.i = or i32 %2, %1
 store i32 0, ptr @g_1032, align 4
  %.b575 = load i1, ptr @g_180, align 4
 %3 = select i1 %.b575, i32 1, i32 878456582
  %or542.2.i = or i32 %3, %or542.1.i
  %or542.3.i = or i32 %or542.2.i, 1
  store i32 %or542.3.i, ptr %0, align 4
  %4 = load i32, ptr %0, align 4
  %div.i1796.i = sdiv i32 %4, 1096912269
  %5 = tail call i32 @llvm.ctpop.i32(i32 %div.i1796.i)
  ret i32 %5
}
```
```
llc: /root/llvm-project/llvm/lib/Target/X86/X86ISelLowering.cpp:32177: llvm::SDValue LowerCTPOP(llvm::SDValue, const llvm::X86Subtarget&, llvm::SelectionDAG&): Assertion `(LZ + TZ) < Known.getBitWidth() && "Illegal shifted mask"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/llc -o /app/output.s <source>
1.	Running pass 'Function Pass Manager' on module '<source>'.
2.	Running pass 'X86 DAG->DAG Instruction Selection' on function '@test'
 #0 0x0000000003ca0728 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3ca0728)
 #1 0x0000000003c9e12c SignalHandler(int) Signals.cpp:0:0
 #2 0x0000713ac9442520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #3 0x0000713ac94969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #4 0x0000713ac9442476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #5 0x0000713ac94287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #6 0x0000713ac942871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #7 0x0000713ac9439e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
 #8 0x000000000204f30f LowerCTPOP(llvm::SDValue, llvm::X86Subtarget const&, llvm::SelectionDAG&) X86ISelLowering.cpp:0:0
 #9 0x000000000218da52 llvm::X86TargetLowering::LowerOperation(llvm::SDValue, llvm::SelectionDAG&) const (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x218da52)
#10 0x0000000003938110 (anonymous namespace)::SelectionDAGLegalize::LegalizeOp(llvm::SDNode*) (.part.0) LegalizeDAG.cpp:0:0
#11 0x000000000393bc16 llvm::SelectionDAG::Legalize() (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x393bc16)
#12 0x0000000003a53dcd llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3a53dcd)
#13 0x0000000003a574b9 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3a574b9)
#14 0x0000000003a58760 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3a58760)
#15 0x0000000003a4910f llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3a4910f)
#16 0x0000000002bda179 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#17 0x00000000031e250f llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x31e250f)
#18 0x00000000031e28c1 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x31e28c1)
#19 0x00000000031e3161 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x31e3161)
#20 0x000000000089fc50 compileModule(char**, llvm::LLVMContext&) llc.cpp:0:0
#21 0x0000000000788a0e main (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x788a0e)
#22 0x0000713ac9429d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#23 0x0000713ac9429e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#24 0x0000000000896525 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x896525)
Program terminated with signal: SIGSEGV
Compiler returned: 139
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to