mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 12:41:49 +01:00
[PowerPC] Fix a crash in POWER 9 setb peephole
Variable InnerIsSel references FalseRes, while FalseRes might be zext/sext. So InnerIsSel should reference SetOrSelCC, otherwise a crash will happen. Reviewed By: steven.zhang Differential Revision: https://reviews.llvm.org/D90142
This commit is contained in:
parent
b02682f887
commit
fe86a99411
@ -4233,8 +4233,10 @@ static bool mayUseP9Setb(SDNode *N, const ISD::CondCode &CC, SelectionDAG *DAG,
|
||||
(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;
|
||||
|
@ -1328,3 +1328,18 @@ define i64 @setbn3(float %a, float %b) {
|
||||
; 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
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user