[clang] [llvm] [CVP] Infer range return attribute (PR #99620)

Nikita Popov via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 19 02:55:01 PDT 2024


https://github.com/nikic updated https://github.com/llvm/llvm-project/pull/99620

>From 23bdf84091020df916441b3ed2d2cc74f4059e37 Mon Sep 17 00:00:00 2001
From: Nikita Popov <npopov at redhat.com>
Date: Fri, 19 Jul 2024 11:02:56 +0200
Subject: [PATCH] [CVP] Infer range return attribute

We already infer this in IPSCCP, but as that pass runs very
early, it cannot make use of simplifications (in particular
post-inline simplifications).

This fixes most cases from https://github.com/llvm/llvm-project/issues/98946
(everything apart from f2 where the assume is dropped).
---
 clang/test/CodeGen/attr-counted-by.c          |  8 +-
 .../Scalar/CorrelatedValuePropagation.cpp     | 18 +++++
 .../CorrelatedValuePropagation/add.ll         |  2 +-
 .../CorrelatedValuePropagation/ashr.ll        |  8 +-
 .../CorrelatedValuePropagation/basic.ll       | 78 +++++++++----------
 .../cond-using-block-value.ll                 |  2 +-
 .../CorrelatedValuePropagation/select.ll      |  8 +-
 .../CorrelatedValuePropagation/vectors.ll     | 44 +++++------
 8 files changed, 93 insertions(+), 75 deletions(-)

diff --git a/clang/test/CodeGen/attr-counted-by.c b/clang/test/CodeGen/attr-counted-by.c
index 32db136076d7d..0fd3d4cc85f83 100644
--- a/clang/test/CodeGen/attr-counted-by.c
+++ b/clang/test/CodeGen/attr-counted-by.c
@@ -639,7 +639,7 @@ void test6(struct anon_struct *p, int index) {
   p->array[index] = __builtin_dynamic_object_size(p->array, 1);
 }
 
-// SANITIZE-WITH-ATTR-LABEL: define dso_local i64 @test6_bdos(
+// SANITIZE-WITH-ATTR-LABEL: define dso_local range(i64 0, -3) i64 @test6_bdos(
 // SANITIZE-WITH-ATTR-SAME: ptr nocapture noundef readonly [[P:%.*]]) local_unnamed_addr #[[ATTR2]] {
 // SANITIZE-WITH-ATTR-NEXT:  entry:
 // SANITIZE-WITH-ATTR-NEXT:    [[DOT_COUNTED_BY_GEP:%.*]] = getelementptr inbounds i8, ptr [[P]], i64 8
@@ -649,7 +649,7 @@ void test6(struct anon_struct *p, int index) {
 // SANITIZE-WITH-ATTR-NEXT:    [[TMP1:%.*]] = select i1 [[DOTINV]], i64 0, i64 [[TMP0]]
 // SANITIZE-WITH-ATTR-NEXT:    ret i64 [[TMP1]]
 //
-// NO-SANITIZE-WITH-ATTR-LABEL: define dso_local i64 @test6_bdos(
+// NO-SANITIZE-WITH-ATTR-LABEL: define dso_local range(i64 0, -3) i64 @test6_bdos(
 // NO-SANITIZE-WITH-ATTR-SAME: ptr nocapture noundef readonly [[P:%.*]]) local_unnamed_addr #[[ATTR2]] {
 // NO-SANITIZE-WITH-ATTR-NEXT:  entry:
 // NO-SANITIZE-WITH-ATTR-NEXT:    [[DOT_COUNTED_BY_GEP:%.*]] = getelementptr inbounds i8, ptr [[P]], i64 8
@@ -955,7 +955,7 @@ void test10(struct union_of_fams *p, int index) {
   p->bytes[index] = (unsigned char)__builtin_dynamic_object_size(p->bytes, 1);
 }
 
-// SANITIZE-WITH-ATTR-LABEL: define dso_local range(i64 -2147483648, 2147483648) i64 @test10_bdos(
+// SANITIZE-WITH-ATTR-LABEL: define dso_local range(i64 0, 2147483648) i64 @test10_bdos(
 // SANITIZE-WITH-ATTR-SAME: ptr nocapture noundef readonly [[P:%.*]]) local_unnamed_addr #[[ATTR2]] {
 // SANITIZE-WITH-ATTR-NEXT:  entry:
 // SANITIZE-WITH-ATTR-NEXT:    [[DOT_COUNTED_BY_GEP:%.*]] = getelementptr inbounds i8, ptr [[P]], i64 8
@@ -964,7 +964,7 @@ void test10(struct union_of_fams *p, int index) {
 // SANITIZE-WITH-ATTR-NEXT:    [[TMP0:%.*]] = zext nneg i32 [[NARROW]] to i64
 // SANITIZE-WITH-ATTR-NEXT:    ret i64 [[TMP0]]
 //
-// NO-SANITIZE-WITH-ATTR-LABEL: define dso_local range(i64 -2147483648, 2147483648) i64 @test10_bdos(
+// NO-SANITIZE-WITH-ATTR-LABEL: define dso_local range(i64 0, 2147483648) i64 @test10_bdos(
 // NO-SANITIZE-WITH-ATTR-SAME: ptr nocapture noundef readonly [[P:%.*]]) local_unnamed_addr #[[ATTR2]] {
 // NO-SANITIZE-WITH-ATTR-NEXT:  entry:
 // NO-SANITIZE-WITH-ATTR-NEXT:    [[DOT_COUNTED_BY_GEP:%.*]] = getelementptr inbounds i8, ptr [[P]], i64 8
diff --git a/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp b/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
index 95de8eceb6be5..df899495b8c0c 100644
--- a/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
+++ b/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
@@ -1207,6 +1207,11 @@ static bool processAnd(BinaryOperator *BinOp, LazyValueInfo *LVI) {
 static bool runImpl(Function &F, LazyValueInfo *LVI, DominatorTree *DT,
                     const SimplifyQuery &SQ) {
   bool FnChanged = false;
+  std::optional<ConstantRange> RetRange;
+  if (F.getReturnType()->isIntOrIntVectorTy())
+    RetRange =
+        ConstantRange::getEmpty(F.getReturnType()->getScalarSizeInBits());
+
   // Visiting in a pre-order depth-first traversal causes us to simplify early
   // blocks before querying later blocks (which require us to analyze early
   // blocks).  Eagerly simplifying shallow blocks means there is strictly less
@@ -1277,6 +1282,11 @@ static bool runImpl(Function &F, LazyValueInfo *LVI, DominatorTree *DT,
       // constant folding the return values of callees.
       auto *RetVal = RI->getReturnValue();
       if (!RetVal) break; // handle "ret void"
+      if (RetRange && !RetRange->isFullSet())
+        RetRange =
+            RetRange->unionWith(LVI->getConstantRange(RetVal, RI,
+                                                      /*UndefAllowed=*/false));
+
       if (isa<Constant>(RetVal)) break; // nothing to do
       if (auto *C = getConstantAt(RetVal, RI, LVI)) {
         ++NumReturns;
@@ -1289,6 +1299,14 @@ static bool runImpl(Function &F, LazyValueInfo *LVI, DominatorTree *DT,
     FnChanged |= BBChanged;
   }
 
+  // Infer range attribute on return value.
+  if (RetRange && !RetRange->isFullSet()) {
+    Attribute RangeAttr = F.getRetAttribute(Attribute::Range);
+    if (RangeAttr.isValid())
+      RetRange = RetRange->intersectWith(RangeAttr.getRange());
+    if (!RetRange->isEmptySet())
+      F.addRangeRetAttr(*RetRange);
+  }
   return FnChanged;
 }
 
diff --git a/llvm/test/Transforms/CorrelatedValuePropagation/add.ll b/llvm/test/Transforms/CorrelatedValuePropagation/add.ll
index b29a496ab1deb..b1151cdf26ffd 100644
--- a/llvm/test/Transforms/CorrelatedValuePropagation/add.ll
+++ b/llvm/test/Transforms/CorrelatedValuePropagation/add.ll
@@ -311,7 +311,7 @@ exit:
 
 @limit = external global i32
 define i32 @test11(ptr %p, i32 %i) {
-; CHECK-LABEL: define i32 @test11(
+; CHECK-LABEL: define range(i32 0, 2147483645) i32 @test11(
 ; CHECK-SAME: ptr [[P:%.*]], i32 [[I:%.*]]) {
 ; CHECK-NEXT:    [[LIMIT:%.*]] = load i32, ptr [[P]], align 4, !range [[RNG0:![0-9]+]]
 ; CHECK-NEXT:    [[WITHIN_1:%.*]] = icmp ugt i32 [[LIMIT]], [[I]]
diff --git a/llvm/test/Transforms/CorrelatedValuePropagation/ashr.ll b/llvm/test/Transforms/CorrelatedValuePropagation/ashr.ll
index 25bec18a5dbf3..f719effac113e 100644
--- a/llvm/test/Transforms/CorrelatedValuePropagation/ashr.ll
+++ b/llvm/test/Transforms/CorrelatedValuePropagation/ashr.ll
@@ -159,7 +159,7 @@ exit:
 
 ; check that ashr of -1 or 0 is optimized away
 define i32 @test6(i32 %f, i32 %g) {
-; CHECK-LABEL: define i32 @test6(
+; CHECK-LABEL: define range(i32 -1, 1) i32 @test6(
 ; CHECK-SAME: i32 [[F:%.*]], i32 [[G:%.*]]) {
 ; CHECK-NEXT:  [[ENTRY:.*:]]
 ; CHECK-NEXT:    [[TMP0:%.*]] = add i32 [[F]], 1
@@ -177,7 +177,7 @@ entry:
 
 ; same test as above with different numbers
 define i32 @test7(i32 %f, i32 %g) {
-; CHECK-LABEL: define i32 @test7(
+; CHECK-LABEL: define range(i32 -1, 1) i32 @test7(
 ; CHECK-SAME: i32 [[F:%.*]], i32 [[G:%.*]]) {
 ; CHECK-NEXT:  [[ENTRY:.*:]]
 ; CHECK-NEXT:    [[TMP0:%.*]] = and i32 [[F]], -2
@@ -197,7 +197,7 @@ entry:
 
 ; check that ashr of -2 or 1 is not optimized away
 define i32 @test8(i32 %f, i32 %g, i1 %s) {
-; CHECK-LABEL: define i32 @test8(
+; CHECK-LABEL: define range(i32 -2, 2) i32 @test8(
 ; CHECK-SAME: i32 [[F:%.*]], i32 [[G:%.*]], i1 [[S:%.*]]) {
 ; CHECK-NEXT:  [[ENTRY:.*:]]
 ; CHECK-NEXT:    [[TMP0:%.*]] = ashr i32 -2, [[F]]
@@ -213,7 +213,7 @@ entry:
 }
 
 define i32 @may_including_undef(i1 %c.1, i1 %c.2) {
-; CHECK-LABEL: define i32 @may_including_undef(
+; CHECK-LABEL: define range(i32 -1073741824, 1073741824) i32 @may_including_undef(
 ; CHECK-SAME: i1 [[C_1:%.*]], i1 [[C_2:%.*]]) {
 ; CHECK-NEXT:    br i1 [[C_1]], label %[[TRUE_1:.*]], label %[[FALSE:.*]]
 ; CHECK:       [[TRUE_1]]:
diff --git a/llvm/test/Transforms/CorrelatedValuePropagation/basic.ll b/llvm/test/Transforms/CorrelatedValuePropagation/basic.ll
index c529bab4ef4a7..8b33f7be77a0d 100644
--- a/llvm/test/Transforms/CorrelatedValuePropagation/basic.ll
+++ b/llvm/test/Transforms/CorrelatedValuePropagation/basic.ll
@@ -3,7 +3,7 @@
 ; PR2581
 
 define i32 @test1(i1 %C) {
-; CHECK-LABEL: define i32 @test1
+; CHECK-LABEL: define range(i32 10, 12) i32 @test1
 ; CHECK-SAME: (i1 [[C:%.*]]) {
 ; CHECK-NEXT:    br i1 [[C]], label [[EXIT:%.*]], label [[BODY:%.*]]
 ; CHECK:       body:
@@ -82,7 +82,7 @@ bb2:
 
 ; PR1757
 define i32 @test4(i32) {
-; CHECK-LABEL: define i32 @test4
+; CHECK-LABEL: define range(i32 0, 3) i32 @test4
 ; CHECK-SAME: (i32 [[TMP0:%.*]]) {
 ; CHECK-NEXT:  EntryBlock:
 ; CHECK-NEXT:    [[DOTDEMORGAN:%.*]] = icmp sgt i32 [[TMP0]], 2
@@ -210,7 +210,7 @@ return:
 }
 
 define i32 @switch1(i32 %s) {
-; CHECK-LABEL: define i32 @switch1
+; CHECK-LABEL: define range(i32 -1, 2) i32 @switch1
 ; CHECK-SAME: (i32 [[S:%.*]]) {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[CMP:%.*]] = icmp slt i32 [[S]], 0
@@ -250,7 +250,7 @@ next:
 }
 
 define i32 @switch2(i32 %s) {
-; CHECK-LABEL: define i32 @switch2
+; CHECK-LABEL: define range(i32 -1, 2) i32 @switch2
 ; CHECK-SAME: (i32 [[S:%.*]]) {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[CMP:%.*]] = icmp sgt i32 [[S]], 0
@@ -284,7 +284,7 @@ next:
 }
 
 define i32 @switch3(i32 %s) {
-; CHECK-LABEL: define i32 @switch3
+; CHECK-LABEL: define range(i32 -1, 2) i32 @switch3
 ; CHECK-SAME: (i32 [[S:%.*]]) {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[CMP:%.*]] = icmp sgt i32 [[S]], 0
@@ -451,7 +451,7 @@ unreachable:
 }
 
 define i32 @switch_range(i32 %cond) {
-; CHECK-LABEL: define i32 @switch_range
+; CHECK-LABEL: define range(i32 1, 3) i32 @switch_range
 ; CHECK-SAME: (i32 [[COND:%.*]]) {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[S:%.*]] = urem i32 [[COND]], 3
@@ -491,7 +491,7 @@ unreachable:
 ; switch condition, we should not change the default.
 
 define i32 @switch_range_not_full(i32 %cond) {
-; CHECK-LABEL: define i32 @switch_range_not_full
+; CHECK-LABEL: define range(i32 0, 3) i32 @switch_range_not_full
 ; CHECK-SAME: (i32 [[COND:%.*]]) {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[S:%.*]] = urem i32 [[COND]], 3
@@ -526,7 +526,7 @@ unreachable:
 ; PR51531
 
 define i8 @switch_defaultdest_multipleuse(i8 %t0) {
-; CHECK-LABEL: define i8 @switch_defaultdest_multipleuse
+; CHECK-LABEL: define range(i8 0, 1) i8 @switch_defaultdest_multipleuse
 ; CHECK-SAME: (i8 [[T0:%.*]]) {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[O:%.*]] = or i8 [[T0]], 1
@@ -550,7 +550,7 @@ exit:
 }
 
 define i1 @arg_attribute(ptr nonnull %a) {
-; CHECK-LABEL: define i1 @arg_attribute
+; CHECK-LABEL: define range(i1 0, -1) i1 @arg_attribute
 ; CHECK-SAME: (ptr nonnull [[A:%.*]]) {
 ; CHECK-NEXT:    ret i1 false
 ;
@@ -560,7 +560,7 @@ define i1 @arg_attribute(ptr nonnull %a) {
 
 declare nonnull ptr @return_nonnull()
 define i1 @call_attribute() {
-; CHECK-LABEL: define i1 @call_attribute() {
+; CHECK-LABEL: define range(i1 0, -1) i1 @call_attribute() {
 ; CHECK-NEXT:    [[A:%.*]] = call ptr @return_nonnull()
 ; CHECK-NEXT:    ret i1 false
 ;
@@ -570,7 +570,7 @@ define i1 @call_attribute() {
 }
 
 define i1 @umin(i32 %a, i32 %b) {
-; CHECK-LABEL: define i1 @umin
+; CHECK-LABEL: define range(i1 0, -1) i1 @umin
 ; CHECK-SAME: (i32 [[A:%.*]], i32 [[B:%.*]]) {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[CMP:%.*]] = icmp ult i32 [[A]], 5
@@ -603,7 +603,7 @@ out:
 }
 
 define i1 @smin(i32 %a, i32 %b) {
-; CHECK-LABEL: define i1 @smin
+; CHECK-LABEL: define range(i1 0, -1) i1 @smin
 ; CHECK-SAME: (i32 [[A:%.*]], i32 [[B:%.*]]) {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[CMP:%.*]] = icmp ult i32 [[A]], 5
@@ -636,7 +636,7 @@ out:
 }
 
 define i1 @smax(i32 %a, i32 %b) {
-; CHECK-LABEL: define i1 @smax
+; CHECK-LABEL: define range(i1 0, -1) i1 @smax
 ; CHECK-SAME: (i32 [[A:%.*]], i32 [[B:%.*]]) {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[CMP:%.*]] = icmp sgt i32 [[A]], 5
@@ -669,7 +669,7 @@ out:
 }
 
 define i1 @umax(i32 %a, i32 %b) {
-; CHECK-LABEL: define i1 @umax
+; CHECK-LABEL: define range(i1 0, -1) i1 @umax
 ; CHECK-SAME: (i32 [[A:%.*]], i32 [[B:%.*]]) {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[CMP:%.*]] = icmp sgt i32 [[A]], 5
@@ -702,7 +702,7 @@ out:
 }
 
 define i1 @umin_lhs_overdefined_rhs_const(i32 %a) {
-; CHECK-LABEL: define i1 @umin_lhs_overdefined_rhs_const
+; CHECK-LABEL: define range(i1 -1, 0) i1 @umin_lhs_overdefined_rhs_const
 ; CHECK-SAME: (i32 [[A:%.*]]) {
 ; CHECK-NEXT:    [[CMP:%.*]] = icmp ult i32 [[A]], 42
 ; CHECK-NEXT:    [[SEL:%.*]] = select i1 [[CMP]], i32 [[A]], i32 42
@@ -715,7 +715,7 @@ define i1 @umin_lhs_overdefined_rhs_const(i32 %a) {
 }
 
 define i1 @umin_rhs_overdefined_lhs_const(i32 %a) {
-; CHECK-LABEL: define i1 @umin_rhs_overdefined_lhs_const
+; CHECK-LABEL: define range(i1 -1, 0) i1 @umin_rhs_overdefined_lhs_const
 ; CHECK-SAME: (i32 [[A:%.*]]) {
 ; CHECK-NEXT:    [[CMP:%.*]] = icmp uge i32 [[A]], 42
 ; CHECK-NEXT:    [[SEL:%.*]] = select i1 [[CMP]], i32 42, i32 [[A]]
@@ -728,7 +728,7 @@ define i1 @umin_rhs_overdefined_lhs_const(i32 %a) {
 }
 
 define i1 @umin_lhs_overdefined_rhs_range(i32 %a, i32 %b) {
-; CHECK-LABEL: define i1 @umin_lhs_overdefined_rhs_range
+; CHECK-LABEL: define range(i1 -1, 0) i1 @umin_lhs_overdefined_rhs_range
 ; CHECK-SAME: (i32 [[A:%.*]], i32 [[B:%.*]]) {
 ; CHECK-NEXT:    [[ASSUME:%.*]] = icmp ult i32 [[B]], 42
 ; CHECK-NEXT:    call void @llvm.assume(i1 [[ASSUME]])
@@ -745,7 +745,7 @@ define i1 @umin_lhs_overdefined_rhs_range(i32 %a, i32 %b) {
 }
 
 define i1 @umin_rhs_overdefined_lhs_range(i32 %a, i32 %b) {
-; CHECK-LABEL: define i1 @umin_rhs_overdefined_lhs_range
+; CHECK-LABEL: define range(i1 -1, 0) i1 @umin_rhs_overdefined_lhs_range
 ; CHECK-SAME: (i32 [[A:%.*]], i32 [[B:%.*]]) {
 ; CHECK-NEXT:    [[ASSUME:%.*]] = icmp ult i32 [[B]], 42
 ; CHECK-NEXT:    call void @llvm.assume(i1 [[ASSUME]])
@@ -762,7 +762,7 @@ define i1 @umin_rhs_overdefined_lhs_range(i32 %a, i32 %b) {
 }
 
 define i1 @clamp_low1(i32 noundef %a) {
-; CHECK-LABEL: define i1 @clamp_low1
+; CHECK-LABEL: define range(i1 0, -1) i1 @clamp_low1
 ; CHECK-SAME: (i32 noundef [[A:%.*]]) {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[CMP:%.*]] = icmp sge i32 [[A]], 5
@@ -790,7 +790,7 @@ out:
 }
 
 define i1 @clamp_low2(i32 noundef %a) {
-; CHECK-LABEL: define i1 @clamp_low2
+; CHECK-LABEL: define range(i1 0, -1) i1 @clamp_low2
 ; CHECK-SAME: (i32 noundef [[A:%.*]]) {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[CMP:%.*]] = icmp sge i32 [[A]], 5
@@ -818,7 +818,7 @@ out:
 }
 
 define i1 @clamp_low3(i32 noundef %a) {
-; CHECK-LABEL: define i1 @clamp_low3
+; CHECK-LABEL: define range(i1 0, -1) i1 @clamp_low3
 ; CHECK-SAME: (i32 noundef [[A:%.*]]) {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[CMP:%.*]] = icmp sge i32 [[A]], 5
@@ -846,7 +846,7 @@ out:
 }
 
 define i1 @clamp_low4(i32 noundef %a) {
-; CHECK-LABEL: define i1 @clamp_low4
+; CHECK-LABEL: define range(i1 0, -1) i1 @clamp_low4
 ; CHECK-SAME: (i32 noundef [[A:%.*]]) {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[CMP:%.*]] = icmp sge i32 [[A]], 5
@@ -874,7 +874,7 @@ out:
 }
 
 define i1 @clamp_high1(i32 noundef %a) {
-; CHECK-LABEL: define i1 @clamp_high1
+; CHECK-LABEL: define range(i1 0, -1) i1 @clamp_high1
 ; CHECK-SAME: (i32 noundef [[A:%.*]]) {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[CMP:%.*]] = icmp sle i32 [[A]], 5
@@ -902,7 +902,7 @@ out:
 }
 
 define i1 @clamp_high1_or(i32 noundef %a) {
-; CHECK-LABEL: define i1 @clamp_high1_or
+; CHECK-LABEL: define range(i1 0, -1) i1 @clamp_high1_or
 ; CHECK-SAME: (i32 noundef [[A:%.*]]) {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[CMP:%.*]] = icmp sle i32 [[A]], 5
@@ -930,7 +930,7 @@ out:
 }
 
 define i1 @clamp_high2(i32 noundef %a) {
-; CHECK-LABEL: define i1 @clamp_high2
+; CHECK-LABEL: define range(i1 0, -1) i1 @clamp_high2
 ; CHECK-SAME: (i32 noundef [[A:%.*]]) {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[CMP:%.*]] = icmp sle i32 [[A]], 5
@@ -959,7 +959,7 @@ out:
 
 
 define i1 @clamp_high2_or_disjoint(i32 noundef %a) {
-; CHECK-LABEL: define i1 @clamp_high2_or_disjoint
+; CHECK-LABEL: define range(i1 0, -1) i1 @clamp_high2_or_disjoint
 ; CHECK-SAME: (i32 noundef [[A:%.*]]) {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[CMP:%.*]] = icmp sle i32 [[A]], 5
@@ -988,7 +988,7 @@ out:
 
 
 define i1 @clamp_high3(i32 noundef %a) {
-; CHECK-LABEL: define i1 @clamp_high3
+; CHECK-LABEL: define range(i1 0, -1) i1 @clamp_high3
 ; CHECK-SAME: (i32 noundef [[A:%.*]]) {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[CMP:%.*]] = icmp sle i32 [[A]], 5
@@ -1016,7 +1016,7 @@ out:
 }
 
 define i1 @clamp_high4(i32 noundef %a) {
-; CHECK-LABEL: define i1 @clamp_high4
+; CHECK-LABEL: define range(i1 0, -1) i1 @clamp_high4
 ; CHECK-SAME: (i32 noundef [[A:%.*]]) {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[CMP:%.*]] = icmp sle i32 [[A]], 5
@@ -1045,7 +1045,7 @@ out:
 
 ; Just showing arbitrary constants work, not really a clamp
 define i1 @not_clamp_high(i32 noundef %a) {
-; CHECK-LABEL: define i1 @not_clamp_high
+; CHECK-LABEL: define range(i1 0, -1) i1 @not_clamp_high
 ; CHECK-SAME: (i32 noundef [[A:%.*]]) {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[CMP:%.*]] = icmp sle i32 [[A]], 5
@@ -1257,7 +1257,7 @@ exit:
 }
 
 define i1 @zext_unknown(i8 %a) {
-; CHECK-LABEL: define i1 @zext_unknown
+; CHECK-LABEL: define range(i1 -1, 0) i1 @zext_unknown
 ; CHECK-SAME: (i8 [[A:%.*]]) {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[A32:%.*]] = zext i8 [[A]] to i32
@@ -1270,7 +1270,7 @@ entry:
 }
 
 define i1 @trunc_unknown(i32 %a) {
-; CHECK-LABEL: define i1 @trunc_unknown
+; CHECK-LABEL: define range(i1 -1, 0) i1 @trunc_unknown
 ; CHECK-SAME: (i32 [[A:%.*]]) {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[A8:%.*]] = trunc i32 [[A]] to i8
@@ -1420,7 +1420,7 @@ entry:
 
 
 define i1 @and_unknown(i32 %a) {
-; CHECK-LABEL: define i1 @and_unknown
+; CHECK-LABEL: define range(i1 -1, 0) i1 @and_unknown
 ; CHECK-SAME: (i32 [[A:%.*]]) {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[AND:%.*]] = and i32 [[A]], 128
@@ -1433,7 +1433,7 @@ entry:
 }
 
 define i1 @lshr_unknown(i32 %a) {
-; CHECK-LABEL: define i1 @lshr_unknown
+; CHECK-LABEL: define range(i1 -1, 0) i1 @lshr_unknown
 ; CHECK-SAME: (i32 [[A:%.*]]) {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[AND:%.*]] = lshr i32 [[A]], 30
@@ -1446,7 +1446,7 @@ entry:
 }
 
 define i1 @urem_unknown(i32 %a) {
-; CHECK-LABEL: define i1 @urem_unknown
+; CHECK-LABEL: define range(i1 -1, 0) i1 @urem_unknown
 ; CHECK-SAME: (i32 [[A:%.*]]) {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[UREM:%.*]] = urem i32 [[A]], 30
@@ -1459,7 +1459,7 @@ entry:
 }
 
 define i1 @srem_unknown(i32 %a) {
-; CHECK-LABEL: define i1 @srem_unknown
+; CHECK-LABEL: define range(i1 -1, 0) i1 @srem_unknown
 ; CHECK-SAME: (i32 [[A:%.*]]) {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[SREM:%.*]] = srem i32 [[A]], 30
@@ -1481,7 +1481,7 @@ exit2:
 }
 
 define i1 @sdiv_unknown(i32 %a) {
-; CHECK-LABEL: define i1 @sdiv_unknown
+; CHECK-LABEL: define range(i1 -1, 0) i1 @sdiv_unknown
 ; CHECK-SAME: (i32 [[A:%.*]]) {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[SREM:%.*]] = sdiv i32 [[A]], 123
@@ -2037,7 +2037,7 @@ exit:
 }
 
 define i1 @binop_eval_order(i32 %x) {
-; CHECK-LABEL: define i1 @binop_eval_order
+; CHECK-LABEL: define range(i1 -1, 0) i1 @binop_eval_order
 ; CHECK-SAME: (i32 [[X:%.*]]) {
 ; CHECK-NEXT:    [[A:%.*]] = add nuw nsw i32 [[X]], 1
 ; CHECK-NEXT:    [[B:%.*]] = add nuw nsw i32 [[A]], 1
@@ -2052,7 +2052,7 @@ define i1 @binop_eval_order(i32 %x) {
 }
 
 define range(i32 0, 1024) i32 @range_larger(i8 %x) {
-; CHECK-LABEL: define range(i32 0, 1024) i32 @range_larger
+; CHECK-LABEL: define range(i32 0, 256) i32 @range_larger
 ; CHECK-SAME: (i8 [[X:%.*]]) {
 ; CHECK-NEXT:    [[ZEXT:%.*]] = zext i8 [[X]] to i32
 ; CHECK-NEXT:    ret i32 [[ZEXT]]
@@ -2072,7 +2072,7 @@ define range(i32 0, 128) i32 @range_smaller(i8 %x) {
 }
 
 define range(i32 128, 512) i32 @range_intersect(i8 %x) {
-; CHECK-LABEL: define range(i32 128, 512) i32 @range_intersect
+; CHECK-LABEL: define range(i32 128, 256) i32 @range_intersect
 ; CHECK-SAME: (i8 [[X:%.*]]) {
 ; CHECK-NEXT:    [[ZEXT:%.*]] = zext i8 [[X]] to i32
 ; CHECK-NEXT:    ret i32 [[ZEXT]]
diff --git a/llvm/test/Transforms/CorrelatedValuePropagation/cond-using-block-value.ll b/llvm/test/Transforms/CorrelatedValuePropagation/cond-using-block-value.ll
index 252f6596cedc5..a7a1803bccc26 100644
--- a/llvm/test/Transforms/CorrelatedValuePropagation/cond-using-block-value.ll
+++ b/llvm/test/Transforms/CorrelatedValuePropagation/cond-using-block-value.ll
@@ -38,7 +38,7 @@ end:
 }
 
 define i64 @test_sext_from_implied_cond(i32 %a, i32 %b) {
-; CHECK-LABEL: define i64 @test_sext_from_implied_cond(
+; CHECK-LABEL: define range(i64 0, 2147483647) i64 @test_sext_from_implied_cond(
 ; CHECK-SAME: i32 [[A:%.*]], i32 [[B:%.*]]) {
 ; CHECK-NEXT:    [[A_CMP:%.*]] = icmp slt i32 [[A]], 0
 ; CHECK-NEXT:    br i1 [[A_CMP]], label [[END:%.*]], label [[L1:%.*]]
diff --git a/llvm/test/Transforms/CorrelatedValuePropagation/select.ll b/llvm/test/Transforms/CorrelatedValuePropagation/select.ll
index 2054b0fc99d49..c4b96194a9aa4 100644
--- a/llvm/test/Transforms/CorrelatedValuePropagation/select.ll
+++ b/llvm/test/Transforms/CorrelatedValuePropagation/select.ll
@@ -141,7 +141,7 @@ else:
 }
 
 define i8 @not_correlated(i1, i1) {
-; CHECK-LABEL: define i8 @not_correlated
+; CHECK-LABEL: define range(i8 0, 2) i8 @not_correlated
 ; CHECK-SAME: (i1 [[TMP0:%.*]], i1 [[TMP1:%.*]]) {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[S:%.*]] = select i1 [[TMP0]], i8 0, i8 1
@@ -168,7 +168,7 @@ else:
 @b = global i32 0, align 4
 
 define i32 @PR23752() {
-; CHECK-LABEL: define i32 @PR23752() {
+; CHECK-LABEL: define range(i32 1, 2) i32 @PR23752() {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    br label [[FOR_BODY:%.*]]
 ; CHECK:       for.body:
@@ -334,7 +334,7 @@ exit:
 }
 
 define i1 @test6(ptr %p, i1 %unknown) {
-; CHECK-LABEL: define i1 @test6
+; CHECK-LABEL: define range(i1 -1, 0) i1 @test6
 ; CHECK-SAME: (ptr [[P:%.*]], i1 [[UNKNOWN:%.*]]) {
 ; CHECK-NEXT:    [[PVAL:%.*]] = load i32, ptr [[P]], align 4, !noundef [[META0]]
 ; CHECK-NEXT:    [[CMP1:%.*]] = icmp ult i32 [[PVAL]], 255
@@ -361,7 +361,7 @@ exit:
 }
 
 define i64 @select_cond_may_undef(i32 %a) {
-; CHECK-LABEL: define i64 @select_cond_may_undef
+; CHECK-LABEL: define range(i64 -2147483648, 2147483648) i64 @select_cond_may_undef
 ; CHECK-SAME: (i32 [[A:%.*]]) {
 ; CHECK-NEXT:    [[IS_A_NONNEGATIVE:%.*]] = icmp sgt i32 [[A]], 1
 ; CHECK-NEXT:    [[NARROW:%.*]] = select i1 [[IS_A_NONNEGATIVE]], i32 [[A]], i32 0
diff --git a/llvm/test/Transforms/CorrelatedValuePropagation/vectors.ll b/llvm/test/Transforms/CorrelatedValuePropagation/vectors.ll
index 351a2c79cdff4..68d332d7b5565 100644
--- a/llvm/test/Transforms/CorrelatedValuePropagation/vectors.ll
+++ b/llvm/test/Transforms/CorrelatedValuePropagation/vectors.ll
@@ -2,7 +2,7 @@
 ; RUN: opt -S -passes=correlated-propagation < %s | FileCheck %s
 
 define <2 x i1> @cmp1(<2 x i8> %a) {
-; CHECK-LABEL: define <2 x i1> @cmp1(
+; CHECK-LABEL: define range(i1 -1, 0) <2 x i1> @cmp1(
 ; CHECK-SAME: <2 x i8> [[A:%.*]]) {
 ; CHECK-NEXT:    [[ADD:%.*]] = add nuw <2 x i8> [[A]], <i8 1, i8 1>
 ; CHECK-NEXT:    ret <2 x i1> <i1 true, i1 true>
@@ -13,7 +13,7 @@ define <2 x i1> @cmp1(<2 x i8> %a) {
 }
 
 define <2 x i1> @cmp2(<2 x i8> %a) {
-; CHECK-LABEL: define <2 x i1> @cmp2(
+; CHECK-LABEL: define range(i1 -1, 0) <2 x i1> @cmp2(
 ; CHECK-SAME: <2 x i8> [[A:%.*]]) {
 ; CHECK-NEXT:    [[ADD:%.*]] = add nuw <2 x i8> [[A]], <i8 5, i8 5>
 ; CHECK-NEXT:    ret <2 x i1> <i1 true, i1 true>
@@ -24,7 +24,7 @@ define <2 x i1> @cmp2(<2 x i8> %a) {
 }
 
 define <2 x i1> @cmp_nonsplat(<2 x i8> %a) {
-; CHECK-LABEL: define <2 x i1> @cmp_nonsplat(
+; CHECK-LABEL: define range(i1 -1, 0) <2 x i1> @cmp_nonsplat(
 ; CHECK-SAME: <2 x i8> [[A:%.*]]) {
 ; CHECK-NEXT:    [[ADD:%.*]] = add nuw <2 x i8> [[A]], <i8 4, i8 5>
 ; CHECK-NEXT:    ret <2 x i1> <i1 true, i1 true>
@@ -60,7 +60,7 @@ define <2 x i1> @cmp_signedness(<2 x i8> %a) {
 }
 
 define <2 x i16> @infer_nowrap(<2 x i8> %a) {
-; CHECK-LABEL: define <2 x i16> @infer_nowrap(
+; CHECK-LABEL: define range(i16 1, 257) <2 x i16> @infer_nowrap(
 ; CHECK-SAME: <2 x i8> [[A:%.*]]) {
 ; CHECK-NEXT:    [[ZEXT:%.*]] = zext <2 x i8> [[A]] to <2 x i16>
 ; CHECK-NEXT:    [[RES:%.*]] = add nuw nsw <2 x i16> [[ZEXT]], <i16 1, i16 1>
@@ -72,7 +72,7 @@ define <2 x i16> @infer_nowrap(<2 x i8> %a) {
 }
 
 define <2 x i16> @infer_nowrap_nonsplat(<2 x i8> %a) {
-; CHECK-LABEL: define <2 x i16> @infer_nowrap_nonsplat(
+; CHECK-LABEL: define range(i16 1, 258) <2 x i16> @infer_nowrap_nonsplat(
 ; CHECK-SAME: <2 x i8> [[A:%.*]]) {
 ; CHECK-NEXT:    [[ZEXT:%.*]] = zext <2 x i8> [[A]] to <2 x i16>
 ; CHECK-NEXT:    [[RES:%.*]] = add nuw nsw <2 x i16> [[ZEXT]], <i16 1, i16 2>
@@ -84,7 +84,7 @@ define <2 x i16> @infer_nowrap_nonsplat(<2 x i8> %a) {
 }
 
 define <vscale x 2 x i16> @infer_nowrap_scalable(<vscale x 2 x i8> %a) {
-; CHECK-LABEL: define <vscale x 2 x i16> @infer_nowrap_scalable(
+; CHECK-LABEL: define range(i16 1, 257) <vscale x 2 x i16> @infer_nowrap_scalable(
 ; CHECK-SAME: <vscale x 2 x i8> [[A:%.*]]) {
 ; CHECK-NEXT:    [[ZEXT:%.*]] = zext <vscale x 2 x i8> [[A]] to <vscale x 2 x i16>
 ; CHECK-NEXT:    [[RES:%.*]] = add nuw nsw <vscale x 2 x i16> [[ZEXT]], shufflevector (<vscale x 2 x i16> insertelement (<vscale x 2 x i16> poison, i16 1, i64 0), <vscale x 2 x i16> poison, <vscale x 2 x i32> zeroinitializer)
@@ -96,7 +96,7 @@ define <vscale x 2 x i16> @infer_nowrap_scalable(<vscale x 2 x i8> %a) {
 }
 
 define <2 x i16> @infer_nowrap_poison(<2 x i8> %a) {
-; CHECK-LABEL: define <2 x i16> @infer_nowrap_poison(
+; CHECK-LABEL: define range(i16 1, 257) <2 x i16> @infer_nowrap_poison(
 ; CHECK-SAME: <2 x i8> [[A:%.*]]) {
 ; CHECK-NEXT:    [[ZEXT:%.*]] = zext <2 x i8> [[A]] to <2 x i16>
 ; CHECK-NEXT:    [[RES:%.*]] = add nuw nsw <2 x i16> [[ZEXT]], <i16 1, i16 poison>
@@ -108,7 +108,7 @@ define <2 x i16> @infer_nowrap_poison(<2 x i8> %a) {
 }
 
 define <2 x i16> @infer_nowrap_nonsplat_nsw_only(<2 x i8> %a) {
-; CHECK-LABEL: define <2 x i16> @infer_nowrap_nonsplat_nsw_only(
+; CHECK-LABEL: define range(i16 -1, 257) <2 x i16> @infer_nowrap_nonsplat_nsw_only(
 ; CHECK-SAME: <2 x i8> [[A:%.*]]) {
 ; CHECK-NEXT:    [[ZEXT:%.*]] = zext <2 x i8> [[A]] to <2 x i16>
 ; CHECK-NEXT:    [[RES:%.*]] = add nsw <2 x i16> [[ZEXT]], <i16 1, i16 -1>
@@ -120,7 +120,7 @@ define <2 x i16> @infer_nowrap_nonsplat_nsw_only(<2 x i8> %a) {
 }
 
 define <2 x i16> @abs(<2 x i8> %a) {
-; CHECK-LABEL: define <2 x i16> @abs(
+; CHECK-LABEL: define range(i16 0, 256) <2 x i16> @abs(
 ; CHECK-SAME: <2 x i8> [[A:%.*]]) {
 ; CHECK-NEXT:    [[ZEXT:%.*]] = zext <2 x i8> [[A]] to <2 x i16>
 ; CHECK-NEXT:    ret <2 x i16> [[ZEXT]]
@@ -131,7 +131,7 @@ define <2 x i16> @abs(<2 x i8> %a) {
 }
 
 define <2 x i16> @saturating(<2 x i8> %a) {
-; CHECK-LABEL: define <2 x i16> @saturating(
+; CHECK-LABEL: define range(i16 1, 257) <2 x i16> @saturating(
 ; CHECK-SAME: <2 x i8> [[A:%.*]]) {
 ; CHECK-NEXT:    [[ZEXT:%.*]] = zext <2 x i8> [[A]] to <2 x i16>
 ; CHECK-NEXT:    [[RES:%.*]] = add nuw nsw <2 x i16> [[ZEXT]], <i16 1, i16 1>
@@ -156,7 +156,7 @@ define {<2 x i16>, <2 x i1>} @with_overflow(<2 x i8> %a) {
 }
 
 define <2 x i16> @srem1(<2 x i8> %a) {
-; CHECK-LABEL: define <2 x i16> @srem1(
+; CHECK-LABEL: define range(i16 0, 42) <2 x i16> @srem1(
 ; CHECK-SAME: <2 x i8> [[A:%.*]]) {
 ; CHECK-NEXT:    [[ZEXT:%.*]] = zext <2 x i8> [[A]] to <2 x i16>
 ; CHECK-NEXT:    [[RES1_LHS_TRUNC:%.*]] = trunc <2 x i16> [[ZEXT]] to <2 x i8>
@@ -170,7 +170,7 @@ define <2 x i16> @srem1(<2 x i8> %a) {
 }
 
 define <2 x i16> @srem2(<2 x i8> %a) {
-; CHECK-LABEL: define <2 x i16> @srem2(
+; CHECK-LABEL: define range(i16 -41, 42) <2 x i16> @srem2(
 ; CHECK-SAME: <2 x i8> [[A:%.*]]) {
 ; CHECK-NEXT:    [[ZEXT:%.*]] = sext <2 x i8> [[A]] to <2 x i16>
 ; CHECK-NEXT:    [[RES_LHS_TRUNC:%.*]] = trunc <2 x i16> [[ZEXT]] to <2 x i8>
@@ -184,7 +184,7 @@ define <2 x i16> @srem2(<2 x i8> %a) {
 }
 
 define <2 x i16> @ashr(<2 x i8> %a) {
-; CHECK-LABEL: define <2 x i16> @ashr(
+; CHECK-LABEL: define range(i16 0, 128) <2 x i16> @ashr(
 ; CHECK-SAME: <2 x i8> [[A:%.*]]) {
 ; CHECK-NEXT:    [[ZEXT:%.*]] = zext <2 x i8> [[A]] to <2 x i16>
 ; CHECK-NEXT:    [[RES:%.*]] = lshr <2 x i16> [[ZEXT]], <i16 1, i16 1>
@@ -196,7 +196,7 @@ define <2 x i16> @ashr(<2 x i8> %a) {
 }
 
 define <2 x i32> @sext(<2 x i8> %a) {
-; CHECK-LABEL: define <2 x i32> @sext(
+; CHECK-LABEL: define range(i32 0, 256) <2 x i32> @sext(
 ; CHECK-SAME: <2 x i8> [[A:%.*]]) {
 ; CHECK-NEXT:    [[ZEXT:%.*]] = zext <2 x i8> [[A]] to <2 x i16>
 ; CHECK-NEXT:    [[RES:%.*]] = zext nneg <2 x i16> [[ZEXT]] to <2 x i32>
@@ -220,7 +220,7 @@ define <2 x float> @sitofp(<2 x i8> %a) {
 }
 
 define <2 x i16> @and(<2 x i8> %a) {
-; CHECK-LABEL: define <2 x i16> @and(
+; CHECK-LABEL: define range(i16 0, 256) <2 x i16> @and(
 ; CHECK-SAME: <2 x i8> [[A:%.*]]) {
 ; CHECK-NEXT:    [[ZEXT:%.*]] = zext <2 x i8> [[A]] to <2 x i16>
 ; CHECK-NEXT:    ret <2 x i16> [[ZEXT]]
@@ -231,7 +231,7 @@ define <2 x i16> @and(<2 x i8> %a) {
 }
 
 define <2 x i16> @and_with_poison(<2 x i8> %a) {
-; CHECK-LABEL: define <2 x i16> @and_with_poison(
+; CHECK-LABEL: define range(i16 0, 256) <2 x i16> @and_with_poison(
 ; CHECK-SAME: <2 x i8> [[A:%.*]]) {
 ; CHECK-NEXT:    [[ZEXT:%.*]] = zext <2 x i8> [[A]] to <2 x i16>
 ; CHECK-NEXT:    ret <2 x i16> [[ZEXT]]
@@ -242,7 +242,7 @@ define <2 x i16> @and_with_poison(<2 x i8> %a) {
 }
 
 define <4 x i64> @issue_97674_getConstantOnEdge(i1 %cond) {
-; CHECK-LABEL: define <4 x i64> @issue_97674_getConstantOnEdge(
+; CHECK-LABEL: define range(i64 0, 2) <4 x i64> @issue_97674_getConstantOnEdge(
 ; CHECK-SAME: i1 [[COND:%.*]]) {
 ; CHECK-NEXT:  [[ENTRY:.*]]:
 ; CHECK-NEXT:    br i1 [[COND]], label %[[IF_THEN:.*]], label %[[IF_END:.*]]
@@ -266,7 +266,7 @@ if.end:
 }
 
 define <4 x i64> @issue_97674_getConstant() {
-; CHECK-LABEL: define <4 x i64> @issue_97674_getConstant() {
+; CHECK-LABEL: define range(i64 0, 1) <4 x i64> @issue_97674_getConstant() {
 ; CHECK-NEXT:  [[ENTRY:.*:]]
 ; CHECK-NEXT:    [[FOLDS:%.*]] = add nuw nsw <4 x i64> zeroinitializer, zeroinitializer
 ; CHECK-NEXT:    ret <4 x i64> zeroinitializer
@@ -277,7 +277,7 @@ entry:
 }
 
 define <2 x i16> @phi_merge1(i1 %c, <2 x i8> %a) {
-; CHECK-LABEL: define <2 x i16> @phi_merge1(
+; CHECK-LABEL: define range(i16 2, 259) <2 x i16> @phi_merge1(
 ; CHECK-SAME: i1 [[C:%.*]], <2 x i8> [[A:%.*]]) {
 ; CHECK-NEXT:  [[ENTRY:.*]]:
 ; CHECK-NEXT:    [[ZEXT:%.*]] = zext <2 x i8> [[A]] to <2 x i16>
@@ -303,7 +303,7 @@ join:
 }
 
 define <2 x i16> @phi_merge2(i1 %c, <2 x i8> %a) {
-; CHECK-LABEL: define <2 x i16> @phi_merge2(
+; CHECK-LABEL: define range(i16 2, 259) <2 x i16> @phi_merge2(
 ; CHECK-SAME: i1 [[C:%.*]], <2 x i8> [[A:%.*]]) {
 ; CHECK-NEXT:  [[ENTRY:.*]]:
 ; CHECK-NEXT:    [[ZEXT:%.*]] = zext <2 x i8> [[A]] to <2 x i16>
@@ -330,7 +330,7 @@ join:
 
 ;; Check if ICMP instruction is constant folded or not.
 define <2 x i1> @insertelement_fold1() {
-; CHECK-LABEL: define <2 x i1> @insertelement_fold1() {
+; CHECK-LABEL: define range(i1 -1, 0) <2 x i1> @insertelement_fold1() {
 ; CHECK-NEXT:    [[IE1:%.*]] = insertelement <2 x i32> poison, i32 10, i64 0
 ; CHECK-NEXT:    [[IE2:%.*]] = insertelement <2 x i32> [[IE1]], i32 20, i64 1
 ; CHECK-NEXT:    ret <2 x i1> <i1 true, i1 true>
@@ -344,7 +344,7 @@ define <2 x i1> @insertelement_fold1() {
 ;; Check if LVI is able to handle constant vector operands
 ;; in InsertElementInst and CVP is able to fold ICMP instruction.
 define <2 x i1> @insertelement_fold2() {
-; CHECK-LABEL: define <2 x i1> @insertelement_fold2() {
+; CHECK-LABEL: define range(i1 -1, 0) <2 x i1> @insertelement_fold2() {
 ; CHECK-NEXT:    [[IE1:%.*]] = insertelement <2 x i32> <i32 poison, i32 20>, i32 10, i64 0
 ; CHECK-NEXT:    ret <2 x i1> <i1 true, i1 true>
 ;



More information about the cfe-commits mailing list