Skip to content

[PowerPC] Assertion failure in DAGCombineExtBoolTrunc #160040

@nikic

Description

@nikic
target triple = "powerpc64le-unknown-linux-gnu"

define i32 @test(i32 %arg) {
  %icmp = icmp sgt i32 %arg, -1
  %select = select i1 %icmp, i16 1, i16 0
  %select1 = select i1 %icmp, i16 16384, i16 0
  %lshr = lshr i16 %select1, 1
  %zext = zext i16 %lshr to i32
  %lshr2 = lshr i32 %zext, 1
  %shl = shl i16 %select, 1
  %zext3 = zext i16 %shl to i32
  %or = or i32 %lshr2, %zext3
  ret i32 %or
}
llc: /home/npopov/repos/llvm-project/llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1035: const SDValue &llvm::SDNode::getOperand(unsigned int) const: Assertion `Num < NumOperands && "Invalid child # of SDNode!"' 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: build/bin/llc
1.	Running pass 'Function Pass Manager' on module '<stdin>'.
2.	Running pass 'PowerPC DAG->DAG Pattern Instruction Selection' on function '@test'
 #0 0x000000000794da28 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (build/bin/llc+0x794da28)
 #1 0x000000000794b115 llvm::sys::RunSignalHandlers() (build/bin/llc+0x794b115)
 #2 0x000000000794e7d1 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #3 0x00007f8258828bb0 __restore_rt (/lib64/libc.so.6+0x19bb0)
 #4 0x00007f825888209c __pthread_kill_implementation (/lib64/libc.so.6+0x7309c)
 #5 0x00007f8258828a7e gsignal (/lib64/libc.so.6+0x19a7e)
 #6 0x00007f82588106d0 abort (/lib64/libc.so.6+0x16d0)
 #7 0x00007f8258810639 __assert_perror_fail (/lib64/libc.so.6+0x1639)
 #8 0x000000000595cd14 llvm::PPCTargetLowering::DAGCombineExtBoolTrunc(llvm::SDNode*, llvm::TargetLowering::DAGCombinerInfo&) const PPCISelLowering.cpp:0:0
 #9 0x0000000005960e43 llvm::PPCTargetLowering::PerformDAGCombine(llvm::SDNode*, llvm::TargetLowering::DAGCombinerInfo&) const PPCISelLowering.cpp:0:0
#10 0x0000000007527da2 (anonymous namespace)::DAGCombiner::combine(llvm::SDNode*) DAGCombiner.cpp:0:0
#11 0x0000000007526ae6 llvm::SelectionDAG::Combine(llvm::CombineLevel, llvm::BatchAAResults*, llvm::CodeGenOptLevel) (build/bin/llc+0x7526ae6)
#12 0x000000000772cb76 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (build/bin/llc+0x772cb76)
#13 0x000000000772b8c1 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (build/bin/llc+0x772b8c1)
#14 0x0000000007728cf0 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (build/bin/llc+0x7728cf0)
#15 0x0000000005971b4e (anonymous namespace)::PPCDAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&) PPCISelDAGToDAG.cpp:0:0

Metadata

Metadata

Assignees

Labels

backend:PowerPCcrashPrefer [crash-on-valid] or [crash-on-invalid]

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions