[llvm] 98e016d - [ConstraintElim] Handle trivial (ICMP_ULE, 0, B) in doesHold.
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 27 04:12:00 PDT 2023
Author: Florian Hahn
Date: 2023-09-27T12:11:28+01:00
New Revision: 98e016d99732dc8fef8cfd61d6ce1edd042309a1
URL: https://github.com/llvm/llvm-project/commit/98e016d99732dc8fef8cfd61d6ce1edd042309a1
DIFF: https://github.com/llvm/llvm-project/commit/98e016d99732dc8fef8cfd61d6ce1edd042309a1.diff
LOG: [ConstraintElim] Handle trivial (ICMP_ULE, 0, B) in doesHold.
D152730 may add trivial pre-conditions of the form (ICMP_ULE, 0, B),
which won't be handled automatically by the constraint system, because
we don't add Var >= 0 for all variables in the unsigned system.
Handling the trivial condition explicitly here avoids having the
increase the number of rows in the system per variable.
https://alive2.llvm.org/ce/z/QC92ur
Depends on D152730.
Fixes #63125.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D158776
Added:
Modified:
llvm/lib/Transforms/Scalar/ConstraintElimination.cpp
llvm/test/Transforms/ConstraintElimination/add-nsw.ll
llvm/test/Transforms/ConstraintElimination/add-nuw.ll
llvm/test/Transforms/ConstraintElimination/and.ll
llvm/test/Transforms/ConstraintElimination/gep-arithmetic-add.ll
llvm/test/Transforms/ConstraintElimination/gep-arithmetic.ll
llvm/test/Transforms/ConstraintElimination/loops-header-tested-pointer-cmps.ll
llvm/test/Transforms/ConstraintElimination/loops-header-tested-pointer-iv.ll
llvm/test/Transforms/ConstraintElimination/monotonic-int-phis-cfg.ll
llvm/test/Transforms/ConstraintElimination/monotonic-int-phis.ll
llvm/test/Transforms/ConstraintElimination/transfer-signed-facts-to-unsigned.ll
llvm/test/Transforms/ConstraintElimination/transfer-unsigned-facts-to-signed.ll
llvm/test/Transforms/ConstraintElimination/usub-with-overflow.ll
llvm/test/Transforms/PhaseOrdering/loop-access-checks.ll
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp b/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp
index 3b62cd26beeb135..bca37da5ff10f2b 100644
--- a/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp
+++ b/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp
@@ -676,6 +676,17 @@ ConstraintInfo::getConstraint(CmpInst::Predicate Pred, Value *Op0, Value *Op1,
ConstraintTy ConstraintInfo::getConstraintForSolving(CmpInst::Predicate Pred,
Value *Op0,
Value *Op1) const {
+ Constant *NullC = Constant::getNullValue(Op0->getType());
+ // Handle trivially true compares directly to avoid adding V UGE 0 constraints
+ // for all variables in the unsigned system.
+ if ((Pred == CmpInst::ICMP_ULE && Op0 == NullC) ||
+ (Pred == CmpInst::ICMP_UGE && Op1 == NullC)) {
+ auto &Value2Index = getValue2Index(false);
+ // Return constraint that's trivially true.
+ return ConstraintTy(SmallVector<int64_t, 8>(Value2Index.size(), 0), false,
+ false, false);
+ }
+
// If both operands are known to be non-negative, change signed predicates to
// unsigned ones. This increases the reasoning effectiveness in combination
// with the signed <-> unsigned transfer logic.
diff --git a/llvm/test/Transforms/ConstraintElimination/add-nsw.ll b/llvm/test/Transforms/ConstraintElimination/add-nsw.ll
index 59ea575f4440925..5127e92a7c345b7 100644
--- a/llvm/test/Transforms/ConstraintElimination/add-nsw.ll
+++ b/llvm/test/Transforms/ConstraintElimination/add-nsw.ll
@@ -774,8 +774,7 @@ define i1 @add_neg_1_known_sge_uge_1(i32 %a) {
; CHECK-NEXT: [[A_SGE:%.*]] = icmp sge i32 [[A:%.*]], 1
; CHECK-NEXT: call void @llvm.assume(i1 [[A_SGE]])
; CHECK-NEXT: [[SUB:%.*]] = add nsw i32 [[A]], -1
-; CHECK-NEXT: [[C:%.*]] = icmp uge i32 [[SUB]], 0
-; CHECK-NEXT: ret i1 [[C]]
+; CHECK-NEXT: ret i1 true
;
entry:
%a.sge = icmp sge i32 %a, 1
@@ -808,8 +807,7 @@ define i1 @add_neg_1_not_known_sge_uge_1(i32 %a) {
; CHECK-NEXT: [[A_SGE:%.*]] = icmp sge i32 [[A:%.*]], 0
; CHECK-NEXT: call void @llvm.assume(i1 [[A_SGE]])
; CHECK-NEXT: [[SUB:%.*]] = add nsw i32 [[A]], -1
-; CHECK-NEXT: [[C:%.*]] = icmp uge i32 [[SUB]], 0
-; CHECK-NEXT: ret i1 [[C]]
+; CHECK-NEXT: ret i1 true
;
entry:
%a.sge = icmp sge i32 %a, 0
@@ -842,8 +840,7 @@ define i1 @add_neg_3_known_sge_uge_1(i32 %a) {
; CHECK-NEXT: [[A_SGE:%.*]] = icmp sge i32 [[A:%.*]], 4
; CHECK-NEXT: call void @llvm.assume(i1 [[A_SGE]])
; CHECK-NEXT: [[SUB:%.*]] = add nsw i32 [[A]], -3
-; CHECK-NEXT: [[C:%.*]] = icmp uge i32 [[SUB]], 0
-; CHECK-NEXT: ret i1 [[C]]
+; CHECK-NEXT: ret i1 true
;
entry:
%a.sge = icmp sge i32 %a, 4
@@ -876,8 +873,7 @@ define i1 @add_neg_3_not_known_sge_uge_1(i32 %a) {
; CHECK-NEXT: [[A_SGE:%.*]] = icmp sge i32 [[A:%.*]], 2
; CHECK-NEXT: call void @llvm.assume(i1 [[A_SGE]])
; CHECK-NEXT: [[SUB:%.*]] = add nsw i32 [[A]], -3
-; CHECK-NEXT: [[C:%.*]] = icmp uge i32 [[SUB]], 0
-; CHECK-NEXT: ret i1 [[C]]
+; CHECK-NEXT: ret i1 true
;
entry:
%a.sge = icmp sge i32 %a, 2
diff --git a/llvm/test/Transforms/ConstraintElimination/add-nuw.ll b/llvm/test/Transforms/ConstraintElimination/add-nuw.ll
index 67d90e5fd24df65..be3b66af10e0868 100644
--- a/llvm/test/Transforms/ConstraintElimination/add-nuw.ll
+++ b/llvm/test/Transforms/ConstraintElimination/add-nuw.ll
@@ -227,9 +227,7 @@ define void @test.decompose.nonconst(i8 %a, i8 %b, i8 %c, i8 %d) {
; CHECK-NEXT: [[AND_0:%.*]] = and i1 [[C_0]], [[C_1]]
; CHECK-NEXT: br i1 [[AND_0]], label [[IF_THEN:%.*]], label [[IF_END:%.*]]
; CHECK: if.then:
-; CHECK-NEXT: [[C_2:%.*]] = icmp uge i8 [[A]], 0
-; CHECK-NEXT: [[C_3:%.*]] = icmp uge i8 [[B]], 0
-; CHECK-NEXT: [[AND_1:%.*]] = and i1 [[C_2]], [[C_3]]
+; CHECK-NEXT: [[AND_1:%.*]] = and i1 true, true
; CHECK-NEXT: br i1 [[AND_1]], label [[IF_THEN_2:%.*]], label [[IF_END]]
; CHECK: if.then.2:
; CHECK-NEXT: [[ADD_0:%.*]] = add nuw i8 [[A]], [[B]]
diff --git a/llvm/test/Transforms/ConstraintElimination/and.ll b/llvm/test/Transforms/ConstraintElimination/and.ll
index 71c030c5e0c3d91..389a676651a4283 100644
--- a/llvm/test/Transforms/ConstraintElimination/and.ll
+++ b/llvm/test/Transforms/ConstraintElimination/and.ll
@@ -118,10 +118,9 @@ exit:
define i4 @and_compare_undef(i4 %N, i4 %step) {
; CHECK-LABEL: @and_compare_undef(
; CHECK-NEXT: step.check:
-; CHECK-NEXT: [[STEP_POS:%.*]] = icmp uge i4 [[STEP:%.*]], 0
; CHECK-NEXT: [[B1:%.*]] = add i4 undef, -1
; CHECK-NEXT: [[STEP_ULT_N:%.*]] = icmp ult i4 [[B1]], [[N:%.*]]
-; CHECK-NEXT: [[AND_STEP:%.*]] = and i1 [[STEP_POS]], [[STEP_ULT_N]]
+; CHECK-NEXT: [[AND_STEP:%.*]] = and i1 true, [[STEP_ULT_N]]
; CHECK-NEXT: br i1 [[AND_STEP]], label [[PTR_CHECK:%.*]], label [[EXIT:%.*]]
; CHECK: ptr.check:
; CHECK-NEXT: br label [[EXIT]]
diff --git a/llvm/test/Transforms/ConstraintElimination/gep-arithmetic-add.ll b/llvm/test/Transforms/ConstraintElimination/gep-arithmetic-add.ll
index 64126036ab2819b..ea65e890e4f3baa 100644
--- a/llvm/test/Transforms/ConstraintElimination/gep-arithmetic-add.ll
+++ b/llvm/test/Transforms/ConstraintElimination/gep-arithmetic-add.ll
@@ -14,10 +14,9 @@ define i1 @n_unknown(ptr %dst, i32 %n, i32 %i) {
; CHECK: exit:
; CHECK-NEXT: ret i1 false
; CHECK: pre.bb.2:
-; CHECK-NEXT: [[PRE_2:%.*]] = icmp uge i32 [[I:%.*]], 0
-; CHECK-NEXT: br i1 [[PRE_2]], label [[TGT_BB:%.*]], label [[EXIT]]
+; CHECK-NEXT: br i1 true, label [[TGT_BB:%.*]], label [[EXIT]]
; CHECK: tgt.bb:
-; CHECK-NEXT: [[CMP1:%.*]] = icmp ult i32 [[I]], [[N]]
+; CHECK-NEXT: [[CMP1:%.*]] = icmp ult i32 [[I:%.*]], [[N]]
; CHECK-NEXT: ret i1 [[CMP1]]
;
entry:
@@ -50,10 +49,9 @@ define i1 @n_known_zero_due_to_nuw(ptr %dst, i32 %n, i32 %i) {
; CHECK: exit:
; CHECK-NEXT: ret i1 false
; CHECK: pre.bb.2:
-; CHECK-NEXT: [[PRE_2:%.*]] = icmp uge i32 [[I:%.*]], 0
-; CHECK-NEXT: br i1 [[PRE_2]], label [[TGT_BB:%.*]], label [[EXIT]]
+; CHECK-NEXT: br i1 true, label [[TGT_BB:%.*]], label [[EXIT]]
; CHECK: tgt.bb:
-; CHECK-NEXT: [[CMP1:%.*]] = icmp ult i32 [[I]], [[N]]
+; CHECK-NEXT: [[CMP1:%.*]] = icmp ult i32 [[I:%.*]], [[N]]
; CHECK-NEXT: ret i1 [[CMP1]]
;
entry:
@@ -86,10 +84,9 @@ define i4 @inc_ptr_N_could_be_negative(ptr %src, ptr %lower, ptr %upper, i8 %N,
; CHECK: trap.bb:
; CHECK-NEXT: ret i4 2
; CHECK: step.check:
-; CHECK-NEXT: [[STEP_POS:%.*]] = icmp uge i8 [[STEP:%.*]], 0
-; CHECK-NEXT: [[NEXT:%.*]] = add nuw nsw i8 [[STEP]], 2
+; CHECK-NEXT: [[NEXT:%.*]] = add nuw nsw i8 [[STEP:%.*]], 2
; CHECK-NEXT: [[STEP_ULT_N:%.*]] = icmp ult i8 [[NEXT]], [[N]]
-; CHECK-NEXT: [[AND_STEP:%.*]] = and i1 [[STEP_POS]], [[STEP_ULT_N]]
+; CHECK-NEXT: [[AND_STEP:%.*]] = and i1 true, [[STEP_ULT_N]]
; CHECK-NEXT: br i1 [[AND_STEP]], label [[PTR_CHECK:%.*]], label [[EXIT:%.*]]
; CHECK: ptr.check:
; CHECK-NEXT: [[SRC_STEP:%.*]] = getelementptr inbounds i8, ptr [[SRC]], i8 [[STEP]]
@@ -141,10 +138,9 @@ define i4 @inc_ptr_src_uge_end(ptr %src, ptr %lower, ptr %upper, i16 %N, i16 %st
; CHECK: trap.bb:
; CHECK-NEXT: ret i4 2
; CHECK: step.check:
-; CHECK-NEXT: [[STEP_POS:%.*]] = icmp uge i16 [[STEP:%.*]], 0
-; CHECK-NEXT: [[NEXT:%.*]] = add nuw nsw i16 [[STEP]], 2
+; CHECK-NEXT: [[NEXT:%.*]] = add nuw nsw i16 [[STEP:%.*]], 2
; CHECK-NEXT: [[STEP_ULT_N:%.*]] = icmp ult i16 [[NEXT]], [[N]]
-; CHECK-NEXT: [[AND_STEP:%.*]] = and i1 [[STEP_POS]], [[STEP_ULT_N]]
+; CHECK-NEXT: [[AND_STEP:%.*]] = and i1 true, [[STEP_ULT_N]]
; CHECK-NEXT: br i1 [[AND_STEP]], label [[PTR_CHECK:%.*]], label [[EXIT:%.*]]
; CHECK: ptr.check:
; CHECK-NEXT: [[SRC_STEP:%.*]] = getelementptr inbounds i8, ptr [[SRC]], i16 [[STEP]]
diff --git a/llvm/test/Transforms/ConstraintElimination/gep-arithmetic.ll b/llvm/test/Transforms/ConstraintElimination/gep-arithmetic.ll
index 2575e4935ca46ce..0a835fb38a243d6 100644
--- a/llvm/test/Transforms/ConstraintElimination/gep-arithmetic.ll
+++ b/llvm/test/Transforms/ConstraintElimination/gep-arithmetic.ll
@@ -325,9 +325,8 @@ define i4 @ptr_N_and_step_signed_positive_unsigned_checks_only(ptr %src, ptr %lo
; CHECK: trap.bb:
; CHECK-NEXT: ret i4 2
; CHECK: step.check:
-; CHECK-NEXT: [[STEP_UGE_0:%.*]] = icmp uge i16 [[STEP:%.*]], 0
-; CHECK-NEXT: [[STEP_ULT_N:%.*]] = icmp ult i16 [[STEP]], [[N]]
-; CHECK-NEXT: [[AND_2:%.*]] = and i1 [[STEP_UGE_0]], [[STEP_ULT_N]]
+; CHECK-NEXT: [[STEP_ULT_N:%.*]] = icmp ult i16 [[STEP:%.*]], [[N]]
+; CHECK-NEXT: [[AND_2:%.*]] = and i1 true, [[STEP_ULT_N]]
; CHECK-NEXT: br i1 [[AND_2]], label [[PTR_CHECK:%.*]], label [[EXIT:%.*]]
; CHECK: ptr.check:
; CHECK-NEXT: [[SRC_STEP:%.*]] = getelementptr inbounds i8, ptr [[SRC]], i16 1
@@ -381,9 +380,8 @@ define i4 @ptr_N_signed_positive(ptr %src, ptr %lower, ptr %upper, i16 %N, i16 %
; CHECK: trap.bb:
; CHECK-NEXT: ret i4 2
; CHECK: step.check:
-; CHECK-NEXT: [[STEP_POS:%.*]] = icmp uge i16 [[STEP:%.*]], 0
-; CHECK-NEXT: [[STEP_ULT_N:%.*]] = icmp ult i16 [[STEP]], [[N]]
-; CHECK-NEXT: [[AND_STEP:%.*]] = and i1 [[STEP_POS]], [[STEP_ULT_N]]
+; CHECK-NEXT: [[STEP_ULT_N:%.*]] = icmp ult i16 [[STEP:%.*]], [[N]]
+; CHECK-NEXT: [[AND_STEP:%.*]] = and i1 true, [[STEP_ULT_N]]
; CHECK-NEXT: br i1 [[AND_STEP]], label [[PTR_CHECK:%.*]], label [[EXIT:%.*]]
; CHECK: ptr.check:
; CHECK-NEXT: [[SRC_STEP:%.*]] = getelementptr inbounds i8, ptr [[SRC]], i16 [[STEP]]
@@ -432,9 +430,8 @@ define i4 @ptr_N_could_be_negative(ptr %src, ptr %lower, ptr %upper, i8 %N, i8 %
; CHECK: trap.bb:
; CHECK-NEXT: ret i4 2
; CHECK: step.check:
-; CHECK-NEXT: [[STEP_POS:%.*]] = icmp uge i8 [[STEP:%.*]], 0
-; CHECK-NEXT: [[STEP_ULT_N:%.*]] = icmp ult i8 [[STEP]], [[N]]
-; CHECK-NEXT: [[AND_STEP:%.*]] = and i1 [[STEP_POS]], [[STEP_ULT_N]]
+; CHECK-NEXT: [[STEP_ULT_N:%.*]] = icmp ult i8 [[STEP:%.*]], [[N]]
+; CHECK-NEXT: [[AND_STEP:%.*]] = and i1 true, [[STEP_ULT_N]]
; CHECK-NEXT: br i1 [[AND_STEP]], label [[PTR_CHECK:%.*]], label [[EXIT:%.*]]
; CHECK: ptr.check:
; CHECK-NEXT: [[SRC_STEP:%.*]] = getelementptr inbounds i8, ptr [[SRC]], i8 [[STEP]]
@@ -485,9 +482,8 @@ define i4 @ptr_src_uge_end(ptr %src, ptr %lower, ptr %upper, i8 %N, i8 %step) {
; CHECK: trap.bb:
; CHECK-NEXT: ret i4 2
; CHECK: step.check:
-; CHECK-NEXT: [[STEP_POS:%.*]] = icmp uge i8 [[STEP:%.*]], 0
-; CHECK-NEXT: [[STEP_ULT_N:%.*]] = icmp ult i8 [[STEP]], [[N]]
-; CHECK-NEXT: [[AND_STEP:%.*]] = and i1 [[STEP_POS]], [[STEP_ULT_N]]
+; CHECK-NEXT: [[STEP_ULT_N:%.*]] = icmp ult i8 [[STEP:%.*]], [[N]]
+; CHECK-NEXT: [[AND_STEP:%.*]] = and i1 true, [[STEP_ULT_N]]
; CHECK-NEXT: br i1 [[AND_STEP]], label [[PTR_CHECK:%.*]], label [[EXIT:%.*]]
; CHECK: ptr.check:
; CHECK-NEXT: [[SRC_STEP:%.*]] = getelementptr inbounds i8, ptr [[SRC]], i8 [[STEP]]
@@ -541,9 +537,8 @@ define i4 @ptr_N_unsigned_positive(ptr %src, ptr %lower, ptr %upper, i16 %N, i16
; CHECK: trap.bb:
; CHECK-NEXT: ret i4 2
; CHECK: step.check:
-; CHECK-NEXT: [[STEP_POS:%.*]] = icmp uge i16 [[STEP:%.*]], 0
-; CHECK-NEXT: [[STEP_ULT_N:%.*]] = icmp ult i16 [[STEP]], [[N]]
-; CHECK-NEXT: [[AND_STEP:%.*]] = and i1 [[STEP_POS]], [[STEP_ULT_N]]
+; CHECK-NEXT: [[STEP_ULT_N:%.*]] = icmp ult i16 [[STEP:%.*]], [[N]]
+; CHECK-NEXT: [[AND_STEP:%.*]] = and i1 true, [[STEP_ULT_N]]
; CHECK-NEXT: br i1 [[AND_STEP]], label [[PTR_CHECK:%.*]], label [[EXIT:%.*]]
; CHECK: ptr.check:
; CHECK-NEXT: [[SRC_STEP:%.*]] = getelementptr inbounds i8, ptr [[SRC]], i16 [[STEP]]
@@ -596,9 +591,8 @@ define i4 @ptr_N_signed_positive_assume(ptr %src, ptr %lower, ptr %upper, i16 %N
; CHECK: trap.bb:
; CHECK-NEXT: ret i4 2
; CHECK: step.check:
-; CHECK-NEXT: [[STEP_POS:%.*]] = icmp uge i16 [[STEP:%.*]], 0
-; CHECK-NEXT: [[STEP_ULT_N:%.*]] = icmp ult i16 [[STEP]], [[N]]
-; CHECK-NEXT: [[AND_STEP:%.*]] = and i1 [[STEP_POS]], [[STEP_ULT_N]]
+; CHECK-NEXT: [[STEP_ULT_N:%.*]] = icmp ult i16 [[STEP:%.*]], [[N]]
+; CHECK-NEXT: [[AND_STEP:%.*]] = and i1 true, [[STEP_ULT_N]]
; CHECK-NEXT: br i1 [[AND_STEP]], label [[PTR_CHECK:%.*]], label [[EXIT:%.*]]
; CHECK: ptr.check:
; CHECK-NEXT: [[SRC_STEP:%.*]] = getelementptr inbounds i8, ptr [[SRC]], i16 [[STEP]]
diff --git a/llvm/test/Transforms/ConstraintElimination/loops-header-tested-pointer-cmps.ll b/llvm/test/Transforms/ConstraintElimination/loops-header-tested-pointer-cmps.ll
index a610ff96ee55fda..b8ae10f42f03668 100644
--- a/llvm/test/Transforms/ConstraintElimination/loops-header-tested-pointer-cmps.ll
+++ b/llvm/test/Transforms/ConstraintElimination/loops-header-tested-pointer-cmps.ll
@@ -571,14 +571,12 @@ define void @ne_check_in_loop_with_zext(ptr %ptr, ptr %lower, ptr %upper, i8 %n)
; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_BODY:%.*]], label [[FOR_END:%.*]]
; CHECK: for.body:
; CHECK-NEXT: [[GEP_IV:%.*]] = getelementptr inbounds i8, ptr [[PTR]], i16 [[IV]]
-; CHECK-NEXT: [[CMP_IV_UPPER:%.*]] = icmp ule ptr [[UPPER]], [[GEP_IV]]
-; CHECK-NEXT: [[OR:%.*]] = or i1 false, [[CMP_IV_UPPER]]
+; CHECK-NEXT: [[OR:%.*]] = or i1 false, false
; CHECK-NEXT: br i1 [[OR]], label [[TRAP]], label [[FOR_BODY_1:%.*]]
; CHECK: for.body.1:
; CHECK-NEXT: [[ADD:%.*]] = add nuw nsw i16 [[IV]], 1
; CHECK-NEXT: [[GEP_IV_1:%.*]] = getelementptr inbounds i8, ptr [[PTR]], i16 [[ADD]]
-; CHECK-NEXT: [[CMP_IV_1_UPPER:%.*]] = icmp ule ptr [[UPPER]], [[GEP_IV_1]]
-; CHECK-NEXT: [[OR_1:%.*]] = or i1 false, [[CMP_IV_1_UPPER]]
+; CHECK-NEXT: [[OR_1:%.*]] = or i1 false, false
; CHECK-NEXT: br i1 [[OR_1]], label [[TRAP]], label [[FOR_LATCH]]
; CHECK: for.latch:
; CHECK-NEXT: store i8 0, ptr [[GEP_IV]], align 4
diff --git a/llvm/test/Transforms/ConstraintElimination/loops-header-tested-pointer-iv.ll b/llvm/test/Transforms/ConstraintElimination/loops-header-tested-pointer-iv.ll
index 9cb27a44bd70124..eb252d1a5444eae 100644
--- a/llvm/test/Transforms/ConstraintElimination/loops-header-tested-pointer-iv.ll
+++ b/llvm/test/Transforms/ConstraintElimination/loops-header-tested-pointer-iv.ll
@@ -55,8 +55,7 @@ define void @loop_pointer_iv_null_start(ptr %end, ptr %upper) {
; CHECK-NEXT: [[IV:%.*]] = phi ptr [ null, [[ENTRY:%.*]] ], [ [[IV_NEXT:%.*]], [[LOOP_LATCH:%.*]] ]
; CHECK-NEXT: [[C_1:%.*]] = icmp ule ptr [[IV]], [[END]]
; CHECK-NEXT: call void @use(i1 [[C_1]])
-; CHECK-NEXT: [[C_2:%.*]] = icmp uge ptr [[IV]], null
-; CHECK-NEXT: call void @use(i1 [[C_2]])
+; CHECK-NEXT: call void @use(i1 true)
; CHECK-NEXT: [[C_3:%.*]] = icmp ule ptr [[IV]], [[END]]
; CHECK-NEXT: br i1 [[C_3]], label [[LOOP_LATCH]], label [[EXIT]]
; CHECK: loop.latch:
diff --git a/llvm/test/Transforms/ConstraintElimination/monotonic-int-phis-cfg.ll b/llvm/test/Transforms/ConstraintElimination/monotonic-int-phis-cfg.ll
index e5c73280c3c215d..bf35d3c3228ea7f 100644
--- a/llvm/test/Transforms/ConstraintElimination/monotonic-int-phis-cfg.ll
+++ b/llvm/test/Transforms/ConstraintElimination/monotonic-int-phis-cfg.ll
@@ -62,9 +62,8 @@ define void @multiple_successor_to_header_same_incoming(i8 %len.n, i16 %a, i1 %c
; CHECK-NEXT: [[C:%.*]] = icmp eq i16 [[IV]], [[LEN]]
; CHECK-NEXT: br i1 [[C]], label [[EXIT]], label [[FOR_BODY:%.*]]
; CHECK: for.body:
-; CHECK-NEXT: [[T_1:%.*]] = icmp uge i16 [[IV]], 0
; CHECK-NEXT: [[T_2:%.*]] = icmp ult i16 [[IV]], [[A]]
-; CHECK-NEXT: [[AND:%.*]] = and i1 [[T_1]], [[T_2]]
+; CHECK-NEXT: [[AND:%.*]] = and i1 true, [[T_2]]
; CHECK-NEXT: br i1 [[AND]], label [[LOOP_LATCH]], label [[EXIT]]
; CHECK: loop.latch:
; CHECK-NEXT: call void @use(i16 [[IV]])
@@ -124,9 +123,8 @@ define void @multiple_successor_to_header_
diff erent_incoming(i8 %len.n, i16 %a,
; CHECK-NEXT: [[C:%.*]] = icmp eq i16 [[IV]], [[LEN]]
; CHECK-NEXT: br i1 [[C]], label [[EXIT]], label [[FOR_BODY:%.*]]
; CHECK: for.body:
-; CHECK-NEXT: [[T_1:%.*]] = icmp uge i16 [[IV]], 0
; CHECK-NEXT: [[T_2:%.*]] = icmp ult i16 [[IV]], [[A]]
-; CHECK-NEXT: [[AND:%.*]] = and i1 [[T_1]], [[T_2]]
+; CHECK-NEXT: [[AND:%.*]] = and i1 true, [[T_2]]
; CHECK-NEXT: br i1 [[AND]], label [[LOOP_LATCH]], label [[EXIT]]
; CHECK: loop.latch:
; CHECK-NEXT: call void @use(i16 [[IV]])
diff --git a/llvm/test/Transforms/ConstraintElimination/monotonic-int-phis.ll b/llvm/test/Transforms/ConstraintElimination/monotonic-int-phis.ll
index 2c282e1d7099cff..8adc886f698dfde 100644
--- a/llvm/test/Transforms/ConstraintElimination/monotonic-int-phis.ll
+++ b/llvm/test/Transforms/ConstraintElimination/monotonic-int-phis.ll
@@ -20,8 +20,7 @@ define void @test_monotonic_ptr_iv_inc_1_eq_to_uge(i8 %len.n, i16 %a) {
; CHECK-NEXT: [[C:%.*]] = icmp eq i16 [[IV]], [[LEN]]
; CHECK-NEXT: br i1 [[C]], label [[EXIT]], label [[FOR_BODY:%.*]]
; CHECK: for.body:
-; CHECK-NEXT: [[T_2:%.*]] = icmp ult i16 [[IV]], [[A]]
-; CHECK-NEXT: [[AND:%.*]] = and i1 true, [[T_2]]
+; CHECK-NEXT: [[AND:%.*]] = and i1 true, true
; CHECK-NEXT: br i1 [[AND]], label [[LOOP_LATCH]], label [[EXIT]]
; CHECK: loop.latch:
; CHECK-NEXT: call void @use(i16 [[IV]])
@@ -164,9 +163,8 @@ define void @test_monotonic_ptr_iv_inc_2_eq_to_uge_variable_start(i16 %start, i8
; CHECK-NEXT: [[C:%.*]] = icmp eq i16 [[IV]], [[LEN]]
; CHECK-NEXT: br i1 [[C]], label [[EXIT]], label [[FOR_BODY:%.*]]
; CHECK: for.body:
-; CHECK-NEXT: [[T_1:%.*]] = icmp uge i16 [[IV]], 0
; CHECK-NEXT: [[T_2:%.*]] = icmp ult i16 [[IV]], [[A]]
-; CHECK-NEXT: [[AND:%.*]] = and i1 [[T_1]], [[T_2]]
+; CHECK-NEXT: [[AND:%.*]] = and i1 true, [[T_2]]
; CHECK-NEXT: br i1 [[AND]], label [[LOOP_LATCH]], label [[EXIT]]
; CHECK: loop.latch:
; CHECK-NEXT: call void @use(i16 [[IV]])
diff --git a/llvm/test/Transforms/ConstraintElimination/transfer-signed-facts-to-unsigned.ll b/llvm/test/Transforms/ConstraintElimination/transfer-signed-facts-to-unsigned.ll
index 9a0f24c8adcc577..2fe92628dfa3b64 100644
--- a/llvm/test/Transforms/ConstraintElimination/transfer-signed-facts-to-unsigned.ll
+++ b/llvm/test/Transforms/ConstraintElimination/transfer-signed-facts-to-unsigned.ll
@@ -114,8 +114,7 @@ define i1 @len_not_known_positive2(i8 %len, i8 %idx) {
; CHECK-LABEL: @len_not_known_positive2(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[IDX_SLT_LEN:%.*]] = icmp slt i8 [[IDX:%.*]], [[LEN:%.*]]
-; CHECK-NEXT: [[IDX_POS:%.*]] = icmp uge i8 [[IDX]], 0
-; CHECK-NEXT: [[AND_1:%.*]] = and i1 [[IDX_SLT_LEN]], [[IDX_POS]]
+; CHECK-NEXT: [[AND_1:%.*]] = and i1 [[IDX_SLT_LEN]], true
; CHECK-NEXT: br i1 [[AND_1]], label [[THEN_1:%.*]], label [[ELSE:%.*]]
; CHECK: then.1:
; CHECK-NEXT: [[C_1:%.*]] = icmp ult i8 [[IDX]], [[LEN]]
diff --git a/llvm/test/Transforms/ConstraintElimination/transfer-unsigned-facts-to-signed.ll b/llvm/test/Transforms/ConstraintElimination/transfer-unsigned-facts-to-signed.ll
index 60e915fcebc3eae..23953f18f07d5fe 100644
--- a/llvm/test/Transforms/ConstraintElimination/transfer-unsigned-facts-to-signed.ll
+++ b/llvm/test/Transforms/ConstraintElimination/transfer-unsigned-facts-to-signed.ll
@@ -87,9 +87,8 @@ else:
define i1 @idx_not_known_positive_via_len_uge(i8 %len, i8 %idx) {
; CHECK-LABEL: @idx_not_known_positive_via_len_uge(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[LEN_POS:%.*]] = icmp uge i8 [[LEN:%.*]], 0
-; CHECK-NEXT: [[IDX_ULT_LEN:%.*]] = icmp ult i8 [[IDX:%.*]], [[LEN]]
-; CHECK-NEXT: [[AND_1:%.*]] = and i1 [[LEN_POS]], [[IDX_ULT_LEN]]
+; CHECK-NEXT: [[IDX_ULT_LEN:%.*]] = icmp ult i8 [[IDX:%.*]], [[LEN:%.*]]
+; CHECK-NEXT: [[AND_1:%.*]] = and i1 true, [[IDX_ULT_LEN]]
; CHECK-NEXT: br i1 [[AND_1]], label [[THEN_1:%.*]], label [[ELSE:%.*]]
; CHECK: then.1:
; CHECK-NEXT: [[C_2:%.*]] = icmp sge i8 [[IDX]], 0
diff --git a/llvm/test/Transforms/ConstraintElimination/usub-with-overflow.ll b/llvm/test/Transforms/ConstraintElimination/usub-with-overflow.ll
index 2cc6ec19cfd1da6..06bfd8269d97d7e 100644
--- a/llvm/test/Transforms/ConstraintElimination/usub-with-overflow.ll
+++ b/llvm/test/Transforms/ConstraintElimination/usub-with-overflow.ll
@@ -212,10 +212,9 @@ exit.fail:
define i8 @usub_may_overflow1(i8 %a, i8 %b) {
; CHECK-LABEL: @usub_may_overflow1(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[C_1:%.*]] = icmp uge i8 [[A:%.*]], 0
-; CHECK-NEXT: br i1 [[C_1]], label [[MATH:%.*]], label [[EXIT_FAIL:%.*]]
+; CHECK-NEXT: br i1 true, label [[MATH:%.*]], label [[EXIT_FAIL:%.*]]
; CHECK: math:
-; CHECK-NEXT: [[OP:%.*]] = tail call { i8, i1 } @llvm.usub.with.overflow.i8(i8 [[B:%.*]], i8 [[A]])
+; CHECK-NEXT: [[OP:%.*]] = tail call { i8, i1 } @llvm.usub.with.overflow.i8(i8 [[B:%.*]], i8 [[A:%.*]])
; CHECK-NEXT: [[STATUS:%.*]] = extractvalue { i8, i1 } [[OP]], 1
; CHECK-NEXT: br i1 [[STATUS]], label [[EXIT_FAIL]], label [[EXIT_OK:%.*]]
; CHECK: exit.ok:
diff --git a/llvm/test/Transforms/PhaseOrdering/loop-access-checks.ll b/llvm/test/Transforms/PhaseOrdering/loop-access-checks.ll
index 052a2251cbc930d..b5895fac28ab0a7 100644
--- a/llvm/test/Transforms/PhaseOrdering/loop-access-checks.ll
+++ b/llvm/test/Transforms/PhaseOrdering/loop-access-checks.ll
@@ -145,13 +145,7 @@ define void @foo(ptr noundef nonnull align 8 dereferenceable(24) noalias %vec) #
; CHECK: for.cond.cleanup:
; CHECK-NEXT: ret void
; CHECK: for.body:
-; CHECK-NEXT: [[I_010:%.*]] = phi i64 [ [[INC:%.*]], [[OPERATOR_ACC_EXIT:%.*]] ], [ 0, [[ENTRY:%.*]] ]
-; CHECK-NEXT: [[CMP_NOT_I:%.*]] = icmp ugt i64 [[SUB_PTR_DIV_I_I]], [[I_010]]
-; CHECK-NEXT: br i1 [[CMP_NOT_I]], label [[OPERATOR_ACC_EXIT]], label [[IF_THEN_I:%.*]]
-; CHECK: if.then.i:
-; CHECK-NEXT: tail call void @abort() #[[ATTR1:[0-9]+]]
-; CHECK-NEXT: unreachable
-; CHECK: operator_acc.exit:
+; CHECK-NEXT: [[I_010:%.*]] = phi i64 [ [[INC:%.*]], [[FOR_BODY]] ], [ 0, [[ENTRY:%.*]] ]
; CHECK-NEXT: [[ADD_PTR_I:%.*]] = getelementptr inbounds double, ptr [[TMP1]], i64 [[I_010]]
; CHECK-NEXT: [[TMP2:%.*]] = load double, ptr [[ADD_PTR_I]], align 8
; CHECK-NEXT: [[ADD:%.*]] = fadd double [[TMP2]], 1.000000e+00
More information about the llvm-commits
mailing list