[llvm] c32c668 - [ConstraintElim] Update test to use variable start value.

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 10 09:30:06 PST 2023


Author: Florian Hahn
Date: 2023-03-10T18:29:50+01:00
New Revision: c32c668c8ab7e38b384a108f2f92b36e91809bd6

URL: https://github.com/llvm/llvm-project/commit/c32c668c8ab7e38b384a108f2f92b36e91809bd6
DIFF: https://github.com/llvm/llvm-project/commit/c32c668c8ab7e38b384a108f2f92b36e91809bd6.diff

LOG: [ConstraintElim] Update test to use variable start value.

Otherwise %x <= 10 will be true on the first iteration, making the latch
dead. This makes the test more robust to CE becoming more powerful in
the future.

Added: 
    

Modified: 
    llvm/test/Transforms/ConstraintElimination/loops.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/ConstraintElimination/loops.ll b/llvm/test/Transforms/ConstraintElimination/loops.ll
index 90c4574e21a0c..df008a9c33ebe 100644
--- a/llvm/test/Transforms/ConstraintElimination/loops.ll
+++ b/llvm/test/Transforms/ConstraintElimination/loops.ll
@@ -155,12 +155,12 @@ exit:
   ret i32 20
 }
 
-define void @loop_header_dom_or(i32 %y, i1 %c) {
+define void @loop_header_dom_or(i32 %y, i1 %c, i32 %start) {
 ; CHECK-LABEL: @loop_header_dom_or(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    br i1 [[C:%.*]], label [[LOOP_HEADER:%.*]], label [[EXIT:%.*]]
 ; CHECK:       loop.header:
-; CHECK-NEXT:    [[X:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[X_NEXT:%.*]], [[LOOP_LATCH:%.*]] ]
+; CHECK-NEXT:    [[X:%.*]] = phi i32 [ [[START:%.*]], [[ENTRY:%.*]] ], [ [[X_NEXT:%.*]], [[LOOP_LATCH:%.*]] ]
 ; CHECK-NEXT:    [[X_1:%.*]] = icmp ule i32 [[X]], 10
 ; CHECK-NEXT:    [[Y_1:%.*]] = icmp ugt i32 [[Y:%.*]], 99
 ; CHECK-NEXT:    [[OR:%.*]] = or i1 [[X_1]], [[Y_1]]
@@ -193,7 +193,7 @@ entry:
   br i1 %c, label %loop.header, label %exit
 
 loop.header:
-  %x = phi i32 [ 0, %entry ], [ %x.next, %loop.latch ]
+  %x = phi i32 [ %start, %entry ], [ %x.next, %loop.latch ]
   %x.1 = icmp ule i32 %x, 10
   %y.1 = icmp ugt i32 %y, 99
   %or = or i1 %x.1, %y.1


        


More information about the llvm-commits mailing list