[llvm] 740b8c0 - [InstCombine] Make test more robust (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 1 02:21:49 PDT 2023


Author: Nikita Popov
Date: 2023-08-01T11:21:39+02:00
New Revision: 740b8c06d38d15106da70f0c72c9dde3db0874c0

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

LOG: [InstCombine] Make test more robust (NFC)

Avoid the second backedge condition from being optimized away,
that's not the point of the test.

Added: 
    

Modified: 
    llvm/test/Transforms/InstCombine/freeze.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstCombine/freeze.ll b/llvm/test/Transforms/InstCombine/freeze.ll
index d3274ef2d7596c..3c97563fe0db76 100644
--- a/llvm/test/Transforms/InstCombine/freeze.ll
+++ b/llvm/test/Transforms/InstCombine/freeze.ll
@@ -906,7 +906,7 @@ exit:                                             ; preds = %loop
   ret void
 }
 
-define void @fold_phi_multiple_back_edges(i32 %init, i32 %n) {
+define void @fold_phi_multiple_back_edges(i32 %init, i32 %n, i32 %m) {
 ; CHECK-LABEL: @fold_phi_multiple_back_edges(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[INIT_FR:%.*]] = freeze i32 [[INIT:%.*]]
@@ -918,7 +918,8 @@ define void @fold_phi_multiple_back_edges(i32 %init, i32 %n) {
 ; CHECK-NEXT:    br i1 [[COND]], label [[LOOP]], label [[LOOP_LATCH2]]
 ; CHECK:       loop.latch2:
 ; CHECK-NEXT:    [[I_NEXT2]] = add i32 [[I]], 2
-; CHECK-NEXT:    br i1 false, label [[LOOP]], label [[EXIT:%.*]]
+; CHECK-NEXT:    [[COND2:%.*]] = icmp eq i32 [[I_NEXT]], [[M:%.*]]
+; CHECK-NEXT:    br i1 [[COND2]], label [[LOOP]], label [[EXIT:%.*]]
 ; CHECK:       exit:
 ; CHECK-NEXT:    ret void
 ;
@@ -934,7 +935,7 @@ loop:                                             ; preds = %loop, %entry
 
 loop.latch2:
   %i.next2 = add nsw nuw i32 %i.fr, 2
-  %cond2 = icmp eq i32 %i.next, %n
+  %cond2 = icmp eq i32 %i.next, %m
   br i1 %cond2, label %loop, label %exit
 
 exit:                                             ; preds = %loop


        


More information about the llvm-commits mailing list