Skip to content

Conversation

@madhur13490
Copy link
Contributor

No description provided.

@madhur13490 madhur13490 changed the title [NFC] Regenerate LoopFusion tests using UTC [NFC][LoopFuse] Regenerate LoopFusion tests using UTC Jul 3, 2025
@llvmbot
Copy link
Member

llvmbot commented Jul 3, 2025

@llvm/pr-subscribers-llvm-transforms

Author: Madhur Amilkanthwar (madhur13490)

Changes

Patch is 79.52 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/146902.diff

24 Files Affected:

  • (modified) llvm/test/Transforms/LoopFusion/cannot_fuse.ll (+3-40)
  • (modified) llvm/test/Transforms/LoopFusion/diagnostics_analysis.ll (+3)
  • (modified) llvm/test/Transforms/LoopFusion/diagnostics_missed.ll (+3)
  • (modified) llvm/test/Transforms/LoopFusion/double_loop_nest_inner_guard.ll (+48-18)
  • (modified) llvm/test/Transforms/LoopFusion/four_loops.ll (+71-14)
  • (modified) llvm/test/Transforms/LoopFusion/guarded_peel.ll (+68-25)
  • (modified) llvm/test/Transforms/LoopFusion/guarded_unsafeblock_peel.ll (+35-20)
  • (modified) llvm/test/Transforms/LoopFusion/hoist_load.ll (+11-9)
  • (modified) llvm/test/Transforms/LoopFusion/hoist_preheader.ll (+18-7)
  • (modified) llvm/test/Transforms/LoopFusion/hoist_store.ll (+11-9)
  • (modified) llvm/test/Transforms/LoopFusion/inner_loops.ll (+56-16)
  • (modified) llvm/test/Transforms/LoopFusion/loop_nest.ll (+51-17)
  • (modified) llvm/test/Transforms/LoopFusion/no_sink_hoist.ll (+23-10)
  • (modified) llvm/test/Transforms/LoopFusion/no_sink_hoist_atomic.ll (+22-10)
  • (modified) llvm/test/Transforms/LoopFusion/no_sink_hoist_inner_barrier.ll (+25-16)
  • (modified) llvm/test/Transforms/LoopFusion/no_sink_hoist_load.ll (+24-11)
  • (modified) llvm/test/Transforms/LoopFusion/no_sink_hoist_store.ll (+24-11)
  • (modified) llvm/test/Transforms/LoopFusion/no_sink_hoist_unknown_function.ll (+21-9)
  • (modified) llvm/test/Transforms/LoopFusion/no_sink_hoist_volatile.ll (+22-10)
  • (modified) llvm/test/Transforms/LoopFusion/nonadjacent_peel.ll (+48-19)
  • (modified) llvm/test/Transforms/LoopFusion/peel.ll (+97-35)
  • (modified) llvm/test/Transforms/LoopFusion/sink_preheader.ll (+11-9)
  • (modified) llvm/test/Transforms/LoopFusion/sink_store.ll (+11-9)
  • (modified) llvm/test/Transforms/LoopFusion/triple_loop_nest_inner_guard.ll (+64-26)
diff --git a/llvm/test/Transforms/LoopFusion/cannot_fuse.ll b/llvm/test/Transforms/LoopFusion/cannot_fuse.ll
index 6819ec377ab17..9685eaca71451 100644
--- a/llvm/test/Transforms/LoopFusion/cannot_fuse.ll
+++ b/llvm/test/Transforms/LoopFusion/cannot_fuse.ll
@@ -1,3 +1,4 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
 ; RUN: opt -S -passes=loop-simplify,loop-fusion -debug-only=loop-fusion -disable-output < %s 2>&1 | FileCheck %s
 ; REQUIRES: asserts
 
@@ -82,14 +83,6 @@ bb33:                                             ; preds = %bb33.loopexit, %bb1
 ; CHECK: Performing Loop Fusion on function non_adjacent
 ; CHECK: Fusion Candidates:
 ; CHECK: *** Fusion Candidate Set ***
-; CHECK-NEXT: [[LOOP1PREHEADER:bb[0-9]*]]
-; CHECK-NEXT: [[LOOP2PREHEADER:bb[0-9]*]]
-; CHECK-NEXT: ****************************
-; CHECK: Attempting fusion on Candidate Set:
-; CHECK-NEXT: [[LOOP1PREHEADER]]
-; CHECK-NEXT: [[LOOP2PREHEADER]]
-; CHECK: Fusion candidates are not adjacent. Not fusing.
-; CHECK: Loop Fusion complete
 define void @non_adjacent(ptr noalias %arg) {
 bb:
   br label %bb5
@@ -144,14 +137,6 @@ bb25:                                             ; preds = %bb15
 ; CHECK: Performing Loop Fusion on function different_bounds
 ; CHECK: Fusion Candidates:
 ; CHECK: *** Fusion Candidate Set ***
-; CHECK-NEXT: [[LOOP1PREHEADER:bb[0-9]*]]
-; CHECK-NEXT: [[LOOP2PREHEADER:bb[0-9]*]]
-; CHECK-NEXT: ****************************
-; CHECK: Attempting fusion on Candidate Set:
-; CHECK-NEXT: [[LOOP1PREHEADER]]
-; CHECK-NEXT: [[LOOP2PREHEADER]]
-; CHECK: Fusion candidates do not have identical trip counts. Not fusing.
-; CHECK: Loop Fusion complete
 define void @different_bounds(ptr noalias %arg) {
 bb:
   br label %bb5
@@ -207,14 +192,6 @@ bb25:                                             ; preds = %bb15
 ; CHECK: Performing Loop Fusion on function negative_dependence
 ; CHECK: Fusion Candidates:
 ; CHECK: *** Fusion Candidate Set ***
-; CHECK-NEXT: [[LOOP1PREHEADER:bb[0-9]*]]
-; CHECK-NEXT: [[LOOP2PREHEADER:bb[0-9]*]]
-; CHECK-NEXT: ****************************
-; CHECK: Attempting fusion on Candidate Set:
-; CHECK-NEXT: [[LOOP1PREHEADER]]
-; CHECK-NEXT: [[LOOP2PREHEADER]]
-; CHECK: Memory dependencies do not allow fusion!
-; CHECK: Loop Fusion complete
 define void @negative_dependence(ptr noalias %arg) {
 bb:
   br label %bb7
@@ -261,14 +238,6 @@ bb19:                                             ; preds = %bb18
 ; CHECK: Performing Loop Fusion on function sumTest
 ; CHECK: Fusion Candidates:
 ; CHECK: *** Fusion Candidate Set ***
-; CHECK-NEXT: [[LOOP1PREHEADER:bb[0-9]*]]
-; CHECK-NEXT: [[LOOP2PREHEADER:bb[0-9]*]]
-; CHECK-NEXT: ****************************
-; CHECK: Attempting fusion on Candidate Set:
-; CHECK-NEXT: [[LOOP1PREHEADER]]
-; CHECK-NEXT: [[LOOP2PREHEADER]]
-; CHECK: Memory dependencies do not allow fusion!
-; CHECK: Loop Fusion complete
 define i32 @sumTest(ptr noalias %arg) {
 bb:
   br label %bb9
@@ -315,14 +284,6 @@ bb21:                                             ; preds = %bb14
 ; CHECK: Performing Loop Fusion on function test
 ; CHECK: Fusion Candidates:
 ; CHECK: *** Fusion Candidate Set ***
-; CHECK-NEXT: [[LOOP1PREHEADER:for.body[0-9]*.preheader]]
-; CHECK-NEXT: [[LOOP2PREHEADER:for.body[0-9]*.preheader]]
-; CHECK-NEXT: ****************************
-; CHECK: Attempting fusion on Candidate Set:
-; CHECK-NEXT: [[LOOP1PREHEADER]]
-; CHECK-NEXT: [[LOOP2PREHEADER]]
-; CHECK: Memory dependencies do not allow fusion!
-; CHECK: Loop Fusion complete
 define float @test(ptr nocapture %a, i32 %n) {
 entry:
   %conv = zext i32 %n to i64
@@ -414,3 +375,5 @@ bb27:                                             ; preds = %bb19
 bb29:                                             ; preds = %bb18
   ret void
 }
+;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
+; CHECK: {{.*}}
diff --git a/llvm/test/Transforms/LoopFusion/diagnostics_analysis.ll b/llvm/test/Transforms/LoopFusion/diagnostics_analysis.ll
index 92ca2c10ab0c8..0cf72b32adab7 100644
--- a/llvm/test/Transforms/LoopFusion/diagnostics_analysis.ll
+++ b/llvm/test/Transforms/LoopFusion/diagnostics_analysis.ll
@@ -1,3 +1,4 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
 ; RUN: opt -S -passes=loop-fusion -pass-remarks-analysis=loop-fusion -disable-output < %s 2>&1 | FileCheck %s
 ; REQUIRES: asserts
 
@@ -125,3 +126,5 @@ for.end14:                                        ; preds = %for.cond.cleanup4
 !67 = distinct !{!67, !58, !68}
 !68 = !DILocation(line: 12, column: 3, scope: !26)
 !69 = !DILocation(line: 13, column: 1, scope: !15)
+;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
+; CHECK: {{.*}}
diff --git a/llvm/test/Transforms/LoopFusion/diagnostics_missed.ll b/llvm/test/Transforms/LoopFusion/diagnostics_missed.ll
index f30a070153742..ad649c9442319 100644
--- a/llvm/test/Transforms/LoopFusion/diagnostics_missed.ll
+++ b/llvm/test/Transforms/LoopFusion/diagnostics_missed.ll
@@ -1,3 +1,4 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
 ; RUN: opt -S -passes=loop-fusion -pass-remarks-missed=loop-fusion -disable-output < %s 2>&1 | FileCheck %s
 ; REQUIRES: asserts
 
@@ -395,3 +396,5 @@ attributes #0 = { nounwind readnone speculatable willreturn }
 !84 = distinct !DISubprogram(name: "unsafe_guardblock", scope: !3, file: !3, line: 70, type: !15, scopeLine: 60, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !78)
 !85 = distinct !DILexicalBlock(scope: !84, file: !3, line: 3, column: 5)
 !86 = !DILocation(line: 72, column: 3, scope: !85)
+;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
+; CHECK: {{.*}}
diff --git a/llvm/test/Transforms/LoopFusion/double_loop_nest_inner_guard.ll b/llvm/test/Transforms/LoopFusion/double_loop_nest_inner_guard.ll
index f6eab83b5d154..658e60f5c0032 100644
--- a/llvm/test/Transforms/LoopFusion/double_loop_nest_inner_guard.ll
+++ b/llvm/test/Transforms/LoopFusion/double_loop_nest_inner_guard.ll
@@ -1,3 +1,4 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
 ; RUN: opt -S -passes=loop-fusion < %s 2>&1 | FileCheck %s
 
 ; Verify that LoopFusion can fuse two double-loop nests with guarded inner
@@ -7,19 +8,10 @@
 @b = common global [10 x [10 x i32]] zeroinitializer
 @c = common global [10 x [10 x i32]] zeroinitializer
 
-; CHECK-LABEL: @double_loop_nest_inner_guard
-; CHECK: br i1 %{{.*}}, label %[[OUTER_PH:outer1.ph]], label %[[FUNC_EXIT:func_exit]]
 
-; CHECK: [[OUTER_PH]]:
-; CHECK: br label %[[OUTER_BODY_INNER_GUARD:outer1.body.inner.guard]]
 
-; CHECK: [[OUTER_BODY_INNER_GUARD]]:
-; CHECK: br i1 %{{.*}}, label %[[INNER_PH:inner1.ph]], label %[[OUTER_LATCH:outer2.latch]]
 
-; CHECK: [[INNER_PH]]:
-; CHECK-NEXT: br label %[[INNER_BODY:inner1.body]]
 
-; CHECK: [[INNER_BODY]]:
 ; First loop body.
 ; CHECK: load
 ; CHECK: add
@@ -28,21 +20,59 @@
 ; CHECK: load
 ; CHECK: mul
 ; CHECK: store
-; CHECK: br i1 %{{.*}}, label %[[INNER_EXIT:inner2.exit]], label %[[INNER_BODY:inner1.body]]
 
-; CHECK: [[INNER_EXIT]]:
-; CHECK-NEXT: br label %[[OUTER_LATCH:outer2.latch]]
 
-; CHECK: [[OUTER_LATCH]]:
-; CHECK: br i1 %{{.*}}, label %[[OUTER_EXIT:outer2.exit]], label %[[OUTER_BODY_INNER_GUARD]]
 
-; CHECK: [[OUTER_EXIT]]:
-; CHECK-NEXT: br label %[[FUNC_EXIT:func_exit]]
 
-; CHECK: [[FUNC_EXIT]]:
-; CHECK-NEXT: ret
 
 define i32 @double_loop_nest_inner_guard(i32 %m, i32 %n, i32 %M, i32 %N) {
+; CHECK-LABEL: define i32 @double_loop_nest_inner_guard(
+; CHECK-SAME: i32 [[M:%.*]], i32 [[N:%.*]], i32 [[M:%.*]], i32 [[N:%.*]]) {
+; CHECK-NEXT:  [[ENTRY:.*:]]
+; CHECK-NEXT:    [[CMP63:%.*]] = icmp sgt i32 [[M]], 0
+; CHECK-NEXT:    br i1 [[CMP63]], label %[[OUTER1_PH:.*]], label %[[FUNC_EXIT:.*]]
+; CHECK:       [[OUTER1_PH]]:
+; CHECK-NEXT:    [[CMP261:%.*]] = icmp sgt i32 [[N]], 0
+; CHECK-NEXT:    [[WIDE_TRIP_COUNT76:%.*]] = zext i32 [[M]] to i64
+; CHECK-NEXT:    [[WIDE_TRIP_COUNT72:%.*]] = zext i32 [[N]] to i64
+; CHECK-NEXT:    br label %[[OUTER1_BODY_INNER_GUARD:.*]]
+; CHECK:       [[OUTER1_BODY_INNER_GUARD]]:
+; CHECK-NEXT:    [[IV74:%.*]] = phi i64 [ 0, %[[OUTER1_PH]] ], [ [[IV_NEXT75:%.*]], %[[OUTER2_LATCH:.*]] ]
+; CHECK-NEXT:    [[IV66:%.*]] = phi i64 [ [[IV_NEXT67:%.*]], %[[OUTER2_LATCH]] ], [ 0, %[[OUTER1_PH]] ]
+; CHECK-NEXT:    br i1 [[CMP261]], label %[[INNER1_PH:.*]], label %[[OUTER2_LATCH]]
+; CHECK:       [[INNER1_PH]]:
+; CHECK-NEXT:    br label %[[INNER1_BODY:.*]]
+; CHECK:       [[INNER1_BODY]]:
+; CHECK-NEXT:    [[IV70:%.*]] = phi i64 [ [[IV_NEXT71:%.*]], %[[INNER1_BODY]] ], [ 0, %[[INNER1_PH]] ]
+; CHECK-NEXT:    [[IV:%.*]] = phi i64 [ [[IV_NEXT:%.*]], %[[INNER1_BODY]] ], [ 0, %[[INNER1_PH]] ]
+; CHECK-NEXT:    [[IDX6:%.*]] = getelementptr inbounds [10 x [10 x i32]], ptr @a, i64 0, i64 [[IV74]], i64 [[IV70]]
+; CHECK-NEXT:    [[TMP0:%.*]] = load i32, ptr [[IDX6]], align 4
+; CHECK-NEXT:    [[ADD:%.*]] = add nsw i32 [[TMP0]], 2
+; CHECK-NEXT:    [[IDX10:%.*]] = getelementptr inbounds [10 x [10 x i32]], ptr @b, i64 0, i64 [[IV74]], i64 [[IV70]]
+; CHECK-NEXT:    store i32 [[ADD]], ptr [[IDX10]], align 4
+; CHECK-NEXT:    [[IV_NEXT71]] = add nuw nsw i64 [[IV70]], 1
+; CHECK-NEXT:    [[EXITCOND73:%.*]] = icmp eq i64 [[IV_NEXT71]], [[WIDE_TRIP_COUNT72]]
+; CHECK-NEXT:    [[IDX27:%.*]] = getelementptr inbounds [10 x [10 x i32]], ptr @a, i64 0, i64 [[IV66]], i64 [[IV]]
+; CHECK-NEXT:    [[TMP1:%.*]] = load i32, ptr [[IDX27]], align 4
+; CHECK-NEXT:    [[MUL:%.*]] = shl nsw i32 [[TMP1]], 1
+; CHECK-NEXT:    [[IDX31:%.*]] = getelementptr inbounds [10 x [10 x i32]], ptr @c, i64 0, i64 [[IV66]], i64 [[IV]]
+; CHECK-NEXT:    store i32 [[MUL]], ptr [[IDX31]], align 4
+; CHECK-NEXT:    [[IV_NEXT]] = add nuw nsw i64 [[IV]], 1
+; CHECK-NEXT:    [[EXITCOND:%.*]] = icmp eq i64 [[IV_NEXT]], [[WIDE_TRIP_COUNT72]]
+; CHECK-NEXT:    br i1 [[EXITCOND]], label %[[INNER2_EXIT:.*]], label %[[INNER1_BODY]]
+; CHECK:       [[INNER2_EXIT]]:
+; CHECK-NEXT:    br label %[[OUTER2_LATCH]]
+; CHECK:       [[OUTER2_LATCH]]:
+; CHECK-NEXT:    [[IV_NEXT75]] = add nuw nsw i64 [[IV74]], 1
+; CHECK-NEXT:    [[EXITCOND77:%.*]] = icmp eq i64 [[IV_NEXT75]], [[WIDE_TRIP_COUNT76]]
+; CHECK-NEXT:    [[IV_NEXT67]] = add nuw nsw i64 [[IV66]], 1
+; CHECK-NEXT:    [[EXITCOND69:%.*]] = icmp eq i64 [[IV_NEXT67]], [[WIDE_TRIP_COUNT76]]
+; CHECK-NEXT:    br i1 [[EXITCOND69]], label %[[OUTER2_EXIT:.*]], label %[[OUTER1_BODY_INNER_GUARD]]
+; CHECK:       [[OUTER2_EXIT]]:
+; CHECK-NEXT:    br label %[[FUNC_EXIT]]
+; CHECK:       [[FUNC_EXIT]]:
+; CHECK-NEXT:    ret i32 undef
+;
 entry:
   %cmp63 = icmp sgt i32 %m, 0
   br i1 %cmp63, label %outer1.ph, label %func_exit
diff --git a/llvm/test/Transforms/LoopFusion/four_loops.ll b/llvm/test/Transforms/LoopFusion/four_loops.ll
index 7f7f0f19b59ba..1728686ebc15c 100644
--- a/llvm/test/Transforms/LoopFusion/four_loops.ll
+++ b/llvm/test/Transforms/LoopFusion/four_loops.ll
@@ -1,3 +1,4 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
 ; RUN: opt -S -passes=loop-fusion < %s | FileCheck %s
 
 @A = common global [1024 x i32] zeroinitializer, align 16
@@ -5,21 +6,77 @@
 @C = common global [1024 x i32] zeroinitializer, align 16
 @D = common global [1024 x i32] zeroinitializer, align 16
 
-; CHECK: void @dep_free
-; CHECK-NEXT: bb:
-; CHECK-NEXT: br label %[[LOOP1HEADER:bb[0-9]+]]
-; CHECK: [[LOOP1HEADER]]
-; CHECK: br label %[[LOOP2BODY:bb[0-9]+]]
-; CHECK: [[LOOP2BODY]]
-; CHECK: br label %[[LOOP3BODY:bb[0-9]+]]
-; CHECK: [[LOOP3BODY]]
-; CHECK: br label %[[LOOP4BODY:bb[0-9]+]]
-; CHECK: [[LOOP4BODY]]
-; CHECK: br label %[[LOOP1LATCH:bb[0-9]+]]
-; CHECK: [[LOOP1LATCH]]
-; CHECK: br i1 %{{.*}}, label %[[LOOP1HEADER]], label %[[LOOPEXIT:bb[0-9]+]]
-; CHECK: ret void
 define void @dep_free() {
+; CHECK-LABEL: define void @dep_free() {
+; CHECK-NEXT:  [[BB:.*]]:
+; CHECK-NEXT:    br label %[[BB15:.*]]
+; CHECK:       [[BB15]]:
+; CHECK-NEXT:    [[DOT08:%.*]] = phi i32 [ 0, %[[BB]] ], [ [[TMP23:%.*]], %[[BB61:.*]] ]
+; CHECK-NEXT:    [[INDVARS_IV107:%.*]] = phi i64 [ 0, %[[BB]] ], [ [[INDVARS_IV_NEXT11:%.*]], %[[BB61]] ]
+; CHECK-NEXT:    [[DOT016:%.*]] = phi i32 [ 0, %[[BB]] ], [ [[TMP36:%.*]], %[[BB61]] ]
+; CHECK-NEXT:    [[INDVARS_IV75:%.*]] = phi i64 [ 0, %[[BB]] ], [ [[INDVARS_IV_NEXT8:%.*]], %[[BB61]] ]
+; CHECK-NEXT:    [[DOT024:%.*]] = phi i32 [ 0, %[[BB]] ], [ [[TMP49:%.*]], %[[BB61]] ]
+; CHECK-NEXT:    [[INDVARS_IV43:%.*]] = phi i64 [ 0, %[[BB]] ], [ [[INDVARS_IV_NEXT5:%.*]], %[[BB61]] ]
+; CHECK-NEXT:    [[DOT032:%.*]] = phi i32 [ 0, %[[BB]] ], [ [[TMP62:%.*]], %[[BB61]] ]
+; CHECK-NEXT:    [[INDVARS_IV1:%.*]] = phi i64 [ 0, %[[BB]] ], [ [[INDVARS_IV_NEXT:%.*]], %[[BB61]] ]
+; CHECK-NEXT:    [[TMP:%.*]] = add nsw i32 [[DOT08]], -3
+; CHECK-NEXT:    [[TMP16:%.*]] = add nuw nsw i64 [[INDVARS_IV107]], 3
+; CHECK-NEXT:    [[TMP17:%.*]] = trunc i64 [[TMP16]] to i32
+; CHECK-NEXT:    [[TMP18:%.*]] = mul nsw i32 [[TMP]], [[TMP17]]
+; CHECK-NEXT:    [[TMP19:%.*]] = trunc i64 [[INDVARS_IV107]] to i32
+; CHECK-NEXT:    [[TMP20:%.*]] = srem i32 [[TMP18]], [[TMP19]]
+; CHECK-NEXT:    [[TMP21:%.*]] = getelementptr inbounds [1024 x i32], ptr @A, i64 0, i64 [[INDVARS_IV107]]
+; CHECK-NEXT:    store i32 [[TMP20]], ptr [[TMP21]], align 4
+; CHECK-NEXT:    br label %[[BB22:.*]]
+; CHECK:       [[BB22]]:
+; CHECK-NEXT:    [[TMP28:%.*]] = add nsw i32 [[DOT016]], -3
+; CHECK-NEXT:    [[TMP29:%.*]] = add nuw nsw i64 [[INDVARS_IV75]], 3
+; CHECK-NEXT:    [[TMP30:%.*]] = trunc i64 [[TMP29]] to i32
+; CHECK-NEXT:    [[TMP31:%.*]] = mul nsw i32 [[TMP28]], [[TMP30]]
+; CHECK-NEXT:    [[TMP32:%.*]] = trunc i64 [[INDVARS_IV75]] to i32
+; CHECK-NEXT:    [[TMP33:%.*]] = srem i32 [[TMP31]], [[TMP32]]
+; CHECK-NEXT:    [[TMP34:%.*]] = getelementptr inbounds [1024 x i32], ptr @B, i64 0, i64 [[INDVARS_IV75]]
+; CHECK-NEXT:    store i32 [[TMP33]], ptr [[TMP34]], align 4
+; CHECK-NEXT:    br label %[[BB35:.*]]
+; CHECK:       [[BB35]]:
+; CHECK-NEXT:    [[TMP41:%.*]] = add nsw i32 [[DOT024]], -3
+; CHECK-NEXT:    [[TMP42:%.*]] = add nuw nsw i64 [[INDVARS_IV43]], 3
+; CHECK-NEXT:    [[TMP43:%.*]] = trunc i64 [[TMP42]] to i32
+; CHECK-NEXT:    [[TMP44:%.*]] = mul nsw i32 [[TMP41]], [[TMP43]]
+; CHECK-NEXT:    [[TMP45:%.*]] = trunc i64 [[INDVARS_IV43]] to i32
+; CHECK-NEXT:    [[TMP46:%.*]] = srem i32 [[TMP44]], [[TMP45]]
+; CHECK-NEXT:    [[TMP47:%.*]] = getelementptr inbounds [1024 x i32], ptr @C, i64 0, i64 [[INDVARS_IV43]]
+; CHECK-NEXT:    store i32 [[TMP46]], ptr [[TMP47]], align 4
+; CHECK-NEXT:    br label %[[BB48:.*]]
+; CHECK:       [[BB48]]:
+; CHECK-NEXT:    [[TMP54:%.*]] = add nsw i32 [[DOT032]], -3
+; CHECK-NEXT:    [[TMP55:%.*]] = add nuw nsw i64 [[INDVARS_IV1]], 3
+; CHECK-NEXT:    [[TMP56:%.*]] = trunc i64 [[TMP55]] to i32
+; CHECK-NEXT:    [[TMP57:%.*]] = mul nsw i32 [[TMP54]], [[TMP56]]
+; CHECK-NEXT:    [[TMP58:%.*]] = trunc i64 [[INDVARS_IV1]] to i32
+; CHECK-NEXT:    [[TMP59:%.*]] = srem i32 [[TMP57]], [[TMP58]]
+; CHECK-NEXT:    [[TMP60:%.*]] = getelementptr inbounds [1024 x i32], ptr @D, i64 0, i64 [[INDVARS_IV1]]
+; CHECK-NEXT:    store i32 [[TMP59]], ptr [[TMP60]], align 4
+; CHECK-NEXT:    br label %[[BB61]]
+; CHECK:       [[BB52:.*]]:
+; CHECK-NEXT:    br label %[[BB63:.*]]
+; CHECK:       [[BB61]]:
+; CHECK-NEXT:    [[INDVARS_IV_NEXT11]] = add nuw nsw i64 [[INDVARS_IV107]], 1
+; CHECK-NEXT:    [[TMP23]] = add nuw nsw i32 [[DOT08]], 1
+; CHECK-NEXT:    [[EXITCOND12:%.*]] = icmp ne i64 [[INDVARS_IV_NEXT11]], 100
+; CHECK-NEXT:    [[INDVARS_IV_NEXT8]] = add nuw nsw i64 [[INDVARS_IV75]], 1
+; CHECK-NEXT:    [[TMP36]] = add nuw nsw i32 [[DOT016]], 1
+; CHECK-NEXT:    [[EXITCOND9:%.*]] = icmp ne i64 [[INDVARS_IV_NEXT8]], 100
+; CHECK-NEXT:    [[INDVARS_IV_NEXT5]] = add nuw nsw i64 [[INDVARS_IV43]], 1
+; CHECK-NEXT:    [[TMP49]] = add nuw nsw i32 [[DOT024]], 1
+; CHECK-NEXT:    [[EXITCOND6:%.*]] = icmp ne i64 [[INDVARS_IV_NEXT5]], 100
+; CHECK-NEXT:    [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV1]], 1
+; CHECK-NEXT:    [[TMP62]] = add nuw nsw i32 [[DOT032]], 1
+; CHECK-NEXT:    [[EXITCOND:%.*]] = icmp ne i64 [[INDVARS_IV_NEXT]], 100
+; CHECK-NEXT:    br i1 [[EXITCOND]], label %[[BB15]], label %[[BB52]]
+; CHECK:       [[BB63]]:
+; CHECK-NEXT:    ret void
+;
 bb:
   br label %bb15
 
diff --git a/llvm/test/Transforms/LoopFusion/guarded_peel.ll b/llvm/test/Transforms/LoopFusion/guarded_peel.ll
index c45772b0b0293..c26935908d4d6 100644
--- a/llvm/test/Transforms/LoopFusion/guarded_peel.ll
+++ b/llvm/test/Transforms/LoopFusion/guarded_peel.ll
@@ -1,3 +1,4 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
 ; RUN: opt -S -passes=loop-fusion -loop-fusion-peel-max-count=3 < %s | FileCheck %s
 
 ; Tests if we are able to fuse two guarded loops which have constant but
@@ -6,33 +7,75 @@
 
 @B = common global [1024 x i32] zeroinitializer, align 16
 
-; CHECK-LABEL: void @main(ptr noalias %A)
-; CHECK-NEXT:  entry:
-; CHECK:         br i1 %cmp4, label %for.first.entry, label %for.end
-; CHECK:       for.first.entry
-; CHECK-NEXT:    br label %for.first.peel.begin
-; CHECK:       for.first.peel.begin:
-; CHECK-NEXT:    br label %for.first.peel
-; CHECK:       for.first.peel:
-; CHECK:         br label %for.first.peel.next
-; CHECK:       for.first.peel.next:
-; CHECK-NEXT:    br label %for.first.peel2
-; CHECK:       for.first.peel2:
-; CHECK:         br label %for.first.peel.next1
-; CHECK:       for.first.peel.next1:
-; CHECK-NEXT:    br label %for.first.peel.next11
-; CHECK:       for.first.peel.next11:
-; CHECK-NEXT:    br label %for.first.entry.peel.newph
-; CHECK:       for.first.entry.peel.newph:
-; CHECK:         br label %for.first
-; CHECK:       for.first:
-; CHECK:         br i1 %cmp3, label %for.first, label %for.second.exit
-; CHECK:       for.second.exit:
-; CHECK:         br label %for.end
-; CHECK:       for.end:
-; CHECK-NEXT:    ret void
 
 define void @main(ptr noalias %A) {
+; CHECK-LABEL: define void @main(
+; CHECK-SAME: ptr noalias [[A:%.*]]) {
+; CHECK-NEXT:  [[ENTRY:.*:]]
+; CHECK-NEXT:    [[CMP4:%.*]] = icmp slt i64 0, 45
+; CHECK-NEXT:    [[CMP31:%.*]] = icmp slt i64 2, 45
+; CHECK-NEXT:    br i1 [[CMP4]], label %[[FOR_FIRST_ENTRY:.*]], label %[[FOR_END:.*]]
+; CHECK:       [[FOR_FIRST_ENTRY]]:
+; CHECK-NEXT:    br label %[[FOR_FIRST_PEEL_BEGIN:.*]]
+; CHECK:       [[FOR_FIRST_PEEL_BEGIN]]:
+; CHECK-NEXT:    br label %[[FOR_FIRST_PEEL:.*]]
+; CHECK:       [[FOR_FIRST_PEEL]]:
+; CHECK-NEXT:    [[SUB_PEEL:%.*]] = sub nsw i64 0, 3
+; CHECK-NEXT:    [[ADD_PEEL:%.*]] = add nsw i64 0, 3
+; CHECK-NEXT:    [[MUL_PEEL:%.*]] = mul nsw i64 [[SUB_PEEL]], [[ADD_PEEL]]
+; CHECK-NEXT:    [[REM_PEEL:%.*]] = srem i64 [[MUL_PEEL]], 0
+; CHECK-NEXT:    [[CONV_PEEL:%.*]] = trunc i64 [[REM_PEEL]] to i32
+; CHECK-NEXT:    [[ARRAYIDX_PEEL:%.*]] = getelementptr inbounds i32, ptr [[A]], i64 0
+; CHECK-NEXT:    store i32 [[CONV_PEEL]], ptr [[ARRAYIDX_PEEL]], align 4
+; CHECK-NEXT:    [[INC_PEEL:%.*]] = add nsw i64 0, 1
+; CHECK-NEXT:    [[CMP_PEEL:%.*]] = icmp slt i64 [[INC_PEEL]], 45
+; CHECK-NEXT:    br label %[[FOR_FIRST_PEEL_NEXT:.*]]
+; CHECK:       [[FOR_FIRST_PEEL_NEXT]]:
+; CHECK-NEXT:    br label %[[FOR_FIRST_PEEL2:.*]]
+; CHECK:       [[FOR_FIRST_PEEL2]]:
+; CHECK-NEXT:    [[SUB_PEEL3:%.*]] = sub nsw i64 [[INC_PEEL]], 3
+; CHECK-NEXT:    [[ADD_PEEL4:%.*]] = add nsw i64 [[INC_PEEL]], 3
+; CHECK-NEXT:    [[MUL_PEEL5:%.*]] = mul nsw i64 [[SUB_PEEL3]], [[ADD_PEEL4]]
+; CHECK-NEXT:    [[REM_PEEL6:%.*]] = srem i64 [[MUL_PEEL5]], [[INC_PEEL]]
+; CHECK-NEXT:    [[CONV_PEEL7:%.*]] = trunc i64 [[REM_PEEL6]] to i32
+; CHECK-NEXT:    [[ARRAYIDX_PEEL8:%.*]] = getelementptr inbounds i32, ptr [[A]], i64 [[INC_PEEL]]
+; CHECK-NEXT:    store i32 [[CONV_PEEL7]], ptr [[ARRAYIDX_PEEL8]], align 4
+; CHECK-NEXT:    [[INC_PEEL9:%.*]] = add nsw i64 [[INC_PEEL]], 1
+; CHECK-NEXT:    [[CMP_PEEL10:%.*]] = icmp slt i64 [[INC_PEEL9]], 45
+; CHECK-NEXT:    br label %[[FOR_FIRST_PEEL_NEXT1:.*]]
+; CHECK:       [[FOR_FIRST_PEEL_NEXT1]]:
+; CHECK-NEXT:    br label %[[FOR_FIRST_PEEL_NEXT11:.*]]
+; CHECK:       [[FOR_FIRST_PEEL_NEXT11]]:
+; CHECK-NEXT:    br label %[[FOR_FIRST_ENTRY_PEEL_NEWPH:.*]]
+; CHECK:       [[FOR_FIRST_ENTRY_PEEL_NEWPH]]:
+; CHECK-NEXT:    br label %[[FOR_FIRST:.*]]
+; CHE...
[truncated]

@madhur13490 madhur13490 requested review from kitbarton and nikic July 3, 2025 14:31
Copy link
Contributor

@nikic nikic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please double check that the output looks reasonable? Not all of these tests are UTC compatible or need additional work.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This tests debug output, can't use UTC.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests remarks, can't use UTC.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left behind old check lines.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@madhur13490 madhur13490 force-pushed the loop_fuse_tests branch 2 times, most recently from 3194308 to e61a9e9 Compare July 3, 2025 15:41
@madhur13490
Copy link
Contributor Author

madhur13490 commented Jul 3, 2025

@nikic Thanks for the review. I have pruned the list of affected tests and kept to what is actual correct. Please have a look.

@madhur13490 madhur13490 requested a review from nikic July 3, 2025 15:41
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is checking remarks, so it also shouldn't use UTC.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@madhur13490 madhur13490 requested a review from nikic July 4, 2025 03:49
Copy link
Contributor

@nikic nikic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@madhur13490 madhur13490 merged commit 6181a06 into llvm:main Jul 4, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants