llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

[PowerPC] hit llvm_unreachable("Wasn't expecting to be able to lower this!")

Open diggerlin opened this issue 5 months ago • 3 comments

for the IR bash> cat reduced.ll

define i32 @main(i8 %0) {
entry:
  %cmp2.not.i.4 = icmp eq i8 %0, 0
  %1 = sext i1 %cmp2.not.i.4 to i32
  ret i32 %1
}

bash > llc -mtriple=powerpc-ibm-aix7.2.0.0 reduced.ll

UNREACHABLE executed at llvm/lib/Target/PowerPC/PPCISelLowering.cpp:12790!
PLEASE submit a bug report tohttps://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.and include the crash backtrace and instructions to reproduce the bug.
Stack dump:
0.      Program arguments:llc -mtriple=powerpc-ibm-aix7.2.0.0 reduced.ll
1.      Running pass 'Function Pass Manager' on module 'reduced.ll'.
2.      Running pass 'PowerPC DAG->DAG Pattern Instruction Selection' on function '@main'
IOT/Abort trap             (core dumped) llc -mtriple=powerpc-ibm-aix7.2.0.0 reduced.ll

it hit the in source code

SDValue PPCTargetLowering::LowerOperation(SDValue Op, SelectionDAG &DAG) const {
  switch (Op.getOpcode()) {
  default:
    llvm_unreachable("Wasn't expecting to be able to lower this!");

diggerlin avatar Jun 10 '26 15:06 diggerlin

@llvm/issue-subscribers-backend-powerpc

Author: zhijian lin (diggerlin)

for the IR bash> cat reduced.ll

define i32 @<!-- -->main(i8 %0) {
entry:
  %cmp2.not.i.4 = icmp eq i8 %0, 0
  %1 = sext i1 %cmp2.not.i.4 to i32
  ret i32 %1
}

bash > llc -mtriple=powerpc-ibm-aix7.2.0.0 reduced.ll

UNREACHABLE executed at llvm/lib/Target/PowerPC/PPCISelLowering.cpp:12790! PLEASE submit a bug report tohttps://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.and include the crash backtrace and instructions to reproduce the bug. Stack dump: 0. Program arguments:llc -mtriple=powerpc-ibm-aix7.2.0.0 reduced.ll

  1.  Running pass 'Function Pass Manager' on module 'reduced.ll'.
    
  2.  Running pass 'PowerPC DAG-&gt;DAG Pattern Instruction Selection' on function '@<!-- -->main'
    

IOT/Abort trap (core dumped) llc -mtriple=powerpc-ibm-aix7.2.0.0 reduced.ll

it hit the in source code

SDValue PPCTargetLowering::LowerOperation(SDValue Op, SelectionDAG &DAG) const { switch (Op.getOpcode()) { default: llvm_unreachable("Wasn't expecting to be able to lower this!");

I closed the patch, the patch. https://github.com/llvm/llvm-project/pull/207721 already fix the issue in another way

diggerlin avatar Jul 15 '26 21:07 diggerlin