[PATCH] D90142: [PowerPC] Fix a crash in POWER 9 setb peephole
Qiu Chaofan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Nov 1 22:30:57 PST 2020
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG2762e6734fae: [PowerPC] Fix a crash in POWER 9 setb peephole (authored by qiucf).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D90142/new/
https://reviews.llvm.org/D90142
Files:
llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
llvm/test/CodeGen/PowerPC/ppc64-P9-setb.ll
Index: llvm/test/CodeGen/PowerPC/ppc64-P9-setb.ll
===================================================================
--- llvm/test/CodeGen/PowerPC/ppc64-P9-setb.ll
+++ llvm/test/CodeGen/PowerPC/ppc64-P9-setb.ll
@@ -1328,3 +1328,18 @@
; CHECK: isel
; CHECK: blr
}
+
+; Verify this case doesn't crash
+define void @setbn4(i128 %0, i32* %sel.out) {
+entry:
+; CHECK-LABEL: setbn4:
+; CHECK-NOT: {{\<setb\>}}
+; CHECK: isel
+; CHECK: blr
+ %c1 = icmp ult i128 %0, 5192296858534827628530496329220096
+ %c2 = icmp ugt i128 %0, 5192296858534827628530496329220096
+ %ext = zext i1 %c2 to i32
+ %sel = select i1 %c1, i32 -1, i32 %ext
+ store i32 %sel, i32* %sel.out, align 4
+ ret void
+}
Index: llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
===================================================================
--- llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
+++ llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
@@ -4233,8 +4233,10 @@
(FalseRes.getOpcode() != ISD::SELECT_CC || CC != ISD::SETEQ)))
return false;
- bool InnerIsSel = FalseRes.getOpcode() == ISD::SELECT_CC;
- SDValue SetOrSelCC = InnerIsSel ? FalseRes : FalseRes.getOperand(0);
+ SDValue SetOrSelCC = FalseRes.getOpcode() == ISD::SELECT_CC
+ ? FalseRes
+ : FalseRes.getOperand(0);
+ bool InnerIsSel = SetOrSelCC.getOpcode() == ISD::SELECT_CC;
if (SetOrSelCC.getOpcode() != ISD::SETCC &&
SetOrSelCC.getOpcode() != ISD::SELECT_CC)
return false;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D90142.302204.patch
Type: text/x-patch
Size: 1487 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201102/f4bc48de/attachment.bin>
More information about the llvm-commits
mailing list