Skip to content

[RISCV] Assertion `LHS.getValueType() == VT && RHS.getValueType() == VT && "Cannot use select on differing types"' failed. #90652

Closed
@dtcxzyw

Description

@dtcxzyw

Reduced test case: https://godbolt.org/z/ToPME8sW1

define i1 @test(i64 %x, i1 %cond1, i1 %cond2) {
entry:
  %sadd = call { i64, i1 } @llvm.sadd.with.overflow.i64(i64 %x, i64 1)
  %ov = extractvalue { i64, i1 } %sadd, 1
  %or = or i1 %cond2, %ov
  %sel = select i1 %cond1, i1 %cond2, i1 %or
  ret i1 %sel
}
llc: /root/llvm-project/llvm/include/llvm/CodeGen/SelectionDAG.h:1239: llvm::SDValue llvm::SelectionDAG::getSelect(const llvm::SDLoc&, llvm::EVT, llvm::SDValue, llvm::SDValue, llvm::SDValue): Assertion `LHS.getValueType() == VT && RHS.getValueType() == VT && "Cannot use select on differing types"' 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 -x86-asm-syntax=intel -mtriple=riscv64 <source>
1.	Running pass 'Function Pass Manager' on module '<source>'.
2.	Running pass 'RISC-V DAG->DAG Pattern Instruction Selection' on function '@test'
 #0 0x000000000395b768 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x395b768)
 #1 0x0000000003958ebc SignalHandler(int) Signals.cpp:0:0
 #2 0x000079ecb9e42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #3 0x000079ecb9e969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #4 0x000079ecb9e42476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #5 0x000079ecb9e287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #6 0x000079ecb9e2871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #7 0x000079ecb9e39e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
 #8 0x0000000000bd692f llvm::SelectionDAG::getSelect(llvm::SDLoc const&, llvm::EVT, llvm::SDValue, llvm::SDValue, llvm::SDValue) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0xbd692f)
 #9 0x0000000001ab4ab6 tryFoldSelectIntoOp(llvm::SDNode*, llvm::SelectionDAG&, llvm::SDValue, llvm::SDValue, bool) RISCVISelLowering.cpp:0:0
#10 0x0000000001b125a6 llvm::RISCVTargetLowering::PerformDAGCombine(llvm::SDNode*, llvm::TargetLowering::DAGCombinerInfo&) const (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x1b125a6)
#11 0x00000000035cdb7d (anonymous namespace)::DAGCombiner::combine(llvm::SDNode*) DAGCombiner.cpp:0:0
#12 0x00000000035cf48c (anonymous namespace)::DAGCombiner::Run(llvm::CombineLevel) DAGCombiner.cpp:0:0
#13 0x00000000035d1a6a llvm::SelectionDAG::Combine(llvm::CombineLevel, llvm::AAResults*, llvm::CodeGenOptLevel) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x35d1a6a)
#14 0x00000000037273d2 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x37273d2)
#15 0x000000000372af15 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x372af15)
#16 0x000000000372c987 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (.part.0) SelectionDAGISel.cpp:0:0
#17 0x0000000002976b71 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#18 0x0000000002f36633 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x2f36633)
#19 0x0000000002f36871 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x2f36871)
#20 0x0000000002f370d5 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x2f370d5)
#21 0x000000000082aa5c compileModule(char**, llvm::LLVMContext&) llc.cpp:0:0
#22 0x0000000000728f26 main (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x728f26)
#23 0x000079ecb9e29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#24 0x000079ecb9e29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#25 0x000000000082157e _start (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x82157e)
Program terminated with signal: SIGSEGV
Compiler returned: 139

Metadata

Metadata

Assignees

Labels

backend:RISC-VcrashPrefer [crash-on-valid] or [crash-on-invalid]

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions