forked from OSchip/llvm-project
[ConstraintElimination] Only strip casts preserving the representation.
Things like addrspacecast may not be no-ops, so we should not look through them.
This commit is contained in:
parent
706c1dc266
commit
4858e081d7
|
@ -166,8 +166,8 @@ getConstraint(CmpInst::Predicate Pred, Value *Op0, Value *Op1,
|
|||
if (Pred != CmpInst::ICMP_ULE && Pred != CmpInst::ICMP_ULT)
|
||||
return {};
|
||||
|
||||
auto ADec = decompose(Op0->stripPointerCasts());
|
||||
auto BDec = decompose(Op1->stripPointerCasts());
|
||||
auto ADec = decompose(Op0->stripPointerCastsSameRepresentation());
|
||||
auto BDec = decompose(Op1->stripPointerCastsSameRepresentation());
|
||||
// Skip if decomposing either of the values failed.
|
||||
if (ADec.empty() || BDec.empty())
|
||||
return {};
|
||||
|
|
|
@ -174,19 +174,19 @@ define i1 @addrspacecast_and_cmp(i32* readonly %src, i32* readnone %min, i32* re
|
|||
; CHECK: checks:
|
||||
; CHECK-NEXT: [[C_3_MIN:%.*]] = icmp ult i32* [[GEP_3]], [[MIN]]
|
||||
; CHECK-NEXT: [[C_3_MAX:%.*]] = icmp ult i32* [[GEP_3]], [[MAX]]
|
||||
; CHECK-NEXT: [[RES_1:%.*]] = xor i1 false, [[C_3_MAX]]
|
||||
; CHECK-NEXT: [[RES_1:%.*]] = xor i1 [[C_3_MIN]], [[C_3_MAX]]
|
||||
; CHECK-NEXT: [[GEP_1:%.*]] = getelementptr inbounds i32, i32* [[SRC]], i64 1
|
||||
; CHECK-NEXT: [[C_1_MIN:%.*]] = icmp ult i32* [[GEP_1]], [[MIN]]
|
||||
; CHECK-NEXT: [[C_1_MAX:%.*]] = icmp ult i32* [[GEP_1]], [[MAX]]
|
||||
; CHECK-NEXT: [[RES_2:%.*]] = xor i1 false, true
|
||||
; CHECK-NEXT: [[RES_2:%.*]] = xor i1 [[C_1_MIN]], [[C_1_MAX]]
|
||||
; CHECK-NEXT: [[GEP_2:%.*]] = getelementptr inbounds i32, i32* [[SRC]], i64 2
|
||||
; CHECK-NEXT: [[C_2_MIN:%.*]] = icmp ult i32* [[GEP_2]], [[MIN]]
|
||||
; CHECK-NEXT: [[C_2_MAX:%.*]] = icmp ult i32* [[GEP_2]], [[MAX]]
|
||||
; CHECK-NEXT: [[RES_3:%.*]] = xor i1 false, true
|
||||
; CHECK-NEXT: [[RES_3:%.*]] = xor i1 [[C_2_MIN]], [[C_2_MAX]]
|
||||
; CHECK-NEXT: [[GEP_4:%.*]] = getelementptr inbounds i32, i32* [[SRC]], i64 4
|
||||
; CHECK-NEXT: [[C_4_MIN:%.*]] = icmp ult i32* [[GEP_4]], [[MIN]]
|
||||
; CHECK-NEXT: [[C_4_MAX:%.*]] = icmp ult i32* [[GEP_4]], [[MAX]]
|
||||
; CHECK-NEXT: [[RES_4:%.*]] = xor i1 false, [[C_4_MAX]]
|
||||
; CHECK-NEXT: [[RES_4:%.*]] = xor i1 [[C_4_MIN]], [[C_4_MAX]]
|
||||
; CHECK-NEXT: [[RES_5:%.*]] = xor i1 [[RES_1]], [[RES_2]]
|
||||
; CHECK-NEXT: [[RES_6:%.*]] = xor i1 [[RES_5]], [[RES_3]]
|
||||
; CHECK-NEXT: [[RES_7:%.*]] = xor i1 [[RES_6]], [[RES_4]]
|
||||
|
|
Loading…
Reference in New Issue