[llvm] [LoopUnrollAndJam] Update test dependencies.ll (NFC) (PR #183509)

via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 26 04:41:42 PST 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-transforms

Author: Ryotaro Kasuga (kasuga-fj)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/183509.diff


1 Files Affected:

- (modified) llvm/test/Transforms/LoopUnrollAndJam/dependencies.ll (+160-64) 


``````````diff
diff --git a/llvm/test/Transforms/LoopUnrollAndJam/dependencies.ll b/llvm/test/Transforms/LoopUnrollAndJam/dependencies.ll
index 8dfe4b1dbf3af..bf13f35eb23fa 100644
--- a/llvm/test/Transforms/LoopUnrollAndJam/dependencies.ll
+++ b/llvm/test/Transforms/LoopUnrollAndJam/dependencies.ll
@@ -9,6 +9,15 @@ target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
 ; CHECK: %j.2 = phi
 ; CHECK: %j.3 = phi
 ;
+; for (i = 0; i < 100; i++) {
+;   A[i] = 1;
+;   sum = 0;
+;   for (j = 0; j < 100; j++) {
+;     sum += B[j] * i;
+;   }
+;   A[i-1] = sum;
+; }
+;
 ; fore_aft_less SHOULD be unroll-and-jammed (count=4) as it's safe.
 ; Memory accesses:
 ;   - Fore block: A[i] = 1      (write in outer loop before inner)
@@ -17,10 +26,9 @@ target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
 ; access different array elements, so unrolling the outer loop and jamming the
 ; inner loop is safe. The backward dependency (i-1) doesn't create conflicts
 ; between different unrolled iterations.
-define void @fore_aft_less(ptr noalias nocapture %A, i32 %N, ptr noalias nocapture readonly %B) {
+define void @fore_aft_less(ptr noalias nocapture %A, ptr noalias nocapture readonly %B) {
 entry:
-  %cmp = icmp sgt i32 %N, 0
-  br i1 %cmp, label %for.outer, label %cleanup
+  br label %for.outer
 
 for.outer:
   %i = phi i32 [ %add7, %for.latch ], [ 0, %entry ]
@@ -36,15 +44,15 @@ for.inner:
   %mul = mul nsw i32 %0, %i
   %add = add nsw i32 %mul, %sum
   %add6 = add nuw nsw i32 %j, 1
-  %exitcond = icmp eq i32 %add6, %N
+  %exitcond = icmp eq i32 %add6, 100
   br i1 %exitcond, label %for.latch, label %for.inner
 
 for.latch:
   %add7 = add nuw nsw i32 %i, 1
-  %add72 = add nuw nsw i32 %i, -1
+  %add72 = add nsw i32 %i, -1
   %arrayidx8 = getelementptr inbounds i32, ptr %A, i32 %add72
   store i32 %add, ptr %arrayidx8, align 4
-  %exitcond29 = icmp eq i32 %add7, %N
+  %exitcond29 = icmp eq i32 %add7, 100
   br i1 %exitcond29, label %cleanup, label %for.outer
 
 cleanup:
@@ -58,6 +66,15 @@ cleanup:
 ; CHECK: %j.2 = phi
 ; CHECK: %j.3 = phi
 ;
+; for (i = 0; i < 100; i++) {
+;   A[i] = 1;
+;   sum = 0;
+;   for (j = 0; j < 100; j++) {
+;     sum += B[j] * i;
+;   }
+;   A[i] = sum;
+; }
+;
 ; fore_aft_eq SHOULD be unroll-and-jammed (count=4) as it's safe.
 ; Memory accesses:
 ;   - Fore block: A[i] = 1    (write in outer loop before inner)
@@ -66,10 +83,9 @@ cleanup:
 ; write-after-write (WAW) dependency. However, this is safe for unroll-and-jam
 ; because the aft block write always happens after the fore block write in
 ; the same iteration, preserving the original execution order.
-define void @fore_aft_eq(ptr noalias nocapture %A, i32 %N, ptr noalias nocapture readonly %B) {
+define void @fore_aft_eq(ptr noalias nocapture %A, ptr noalias nocapture readonly %B) {
 entry:
-  %cmp = icmp sgt i32 %N, 0
-  br i1 %cmp, label %for.outer, label %cleanup
+  br label %for.outer
 
 for.outer:
   %i = phi i32 [ %add7, %for.latch ], [ 0, %entry ]
@@ -85,7 +101,7 @@ for.inner:
   %mul = mul nsw i32 %0, %i
   %add = add nsw i32 %mul, %sum
   %add6 = add nuw nsw i32 %j, 1
-  %exitcond = icmp eq i32 %add6, %N
+  %exitcond = icmp eq i32 %add6, 100
   br i1 %exitcond, label %for.latch, label %for.inner
 
 for.latch:
@@ -93,7 +109,7 @@ for.latch:
   %add72 = add nuw nsw i32 %i, 0
   %arrayidx8 = getelementptr inbounds i32, ptr %A, i32 %i
   store i32 %add, ptr %arrayidx8, align 4
-  %exitcond29 = icmp eq i32 %add7, %N
+  %exitcond29 = icmp eq i32 %add7, 100
   br i1 %exitcond29, label %cleanup, label %for.outer
 
 cleanup:
@@ -105,6 +121,15 @@ cleanup:
 ; CHECK: %j = phi
 ; CHECK-NOT: %j.1 = phi
 ;
+; for (i = 0; i < 100; i++) {
+;   A[i] = 1;
+;   sum = 0;
+;   for (j = 0; j < 100; j++) {
+;     sum += B[j] * i;
+;   }
+;   A[i+1] = sum;
+; }
+;
 ; fore_aft_more should NOT be unroll-and-jammed due to a dependency violation.
 ; Memory accesses:
 ;   - Fore block: A[i] = 1      (write in outer loop before inner)
@@ -113,10 +138,9 @@ cleanup:
 ; When unroll-and-jamming, iteration i's aft block writes A[i+1] which conflicts
 ; with iteration i+1's fore block write to A[i+1], creating a write-after-write
 ; race condition that violates the original sequential semantics.
-define void @fore_aft_more(ptr noalias nocapture %A, i32 %N, ptr noalias nocapture readonly %B) {
+define void @fore_aft_more(ptr noalias nocapture %A, ptr noalias nocapture readonly %B) {
 entry:
-  %cmp = icmp sgt i32 %N, 0
-  br i1 %cmp, label %for.outer, label %cleanup
+  br label %for.outer
 
 for.outer:
   %i = phi i32 [ %add7, %for.latch ], [ 0, %entry ]
@@ -132,7 +156,7 @@ for.inner:
   %mul = mul nsw i32 %0, %i
   %add = add nsw i32 %mul, %sum
   %add6 = add nuw nsw i32 %j, 1
-  %exitcond = icmp eq i32 %add6, %N
+  %exitcond = icmp eq i32 %add6, 100
   br i1 %exitcond, label %for.latch, label %for.inner
 
 for.latch:
@@ -140,7 +164,7 @@ for.latch:
   %add72 = add nuw nsw i32 %i, 1
   %arrayidx8 = getelementptr inbounds i32, ptr %A, i32 %add72
   store i32 %add, ptr %arrayidx8, align 4
-  %exitcond29 = icmp eq i32 %add7, %N
+  %exitcond29 = icmp eq i32 %add7, 100
   br i1 %exitcond29, label %cleanup, label %for.outer
 
 cleanup:
@@ -154,6 +178,15 @@ cleanup:
 ; CHECK: %j.2 = phi
 ; CHECK: %j.3 = phi
 ;
+; for (i = 0; i < 100; i++) {
+;   A[i] = 1;
+;   sum = 0;
+;   for (j = 0; j < 100; j++) {
+;     sum += B[j] * i;
+;     A[i-1] = sum;
+;   }
+; }
+;
 ; fore_sub_less SHOULD be unroll-and-jammed (count=4) as it's safe.
 ; Memory accesses:
 ;   - Fore block: A[i] = 1      (write in outer loop before inner)
@@ -161,10 +194,9 @@ cleanup:
 ; No dependency conflict: The fore block writes A[i] and sub block writes A[i-1].
 ; These access different array elements, so unroll-and-jam is safe. The backward
 ; dependency pattern doesn't create conflicts between unrolled iterations.
-define void @fore_sub_less(ptr noalias nocapture %A, i32 %N, ptr noalias nocapture readonly %B) {
+define void @fore_sub_less(ptr noalias nocapture %A, ptr noalias nocapture readonly %B) {
 entry:
-  %cmp = icmp sgt i32 %N, 0
-  br i1 %cmp, label %for.outer, label %cleanup
+  br label %for.outer
 
 for.outer:
   %i = phi i32 [ %add7, %for.latch ], [ 0, %entry ]
@@ -179,16 +211,16 @@ for.inner:
   %0 = load i32, ptr %arrayidx5, align 4
   %mul = mul nsw i32 %0, %i
   %add = add nsw i32 %mul, %sum
-  %add72 = add nuw nsw i32 %i, -1
+  %add72 = add nsw i32 %i, -1
   %arrayidx8 = getelementptr inbounds i32, ptr %A, i32 %add72
   store i32 %add, ptr %arrayidx8, align 4
   %add6 = add nuw nsw i32 %j, 1
-  %exitcond = icmp eq i32 %add6, %N
+  %exitcond = icmp eq i32 %add6, 100
   br i1 %exitcond, label %for.latch, label %for.inner
 
 for.latch:
   %add7 = add nuw nsw i32 %i, 1
-  %exitcond29 = icmp eq i32 %add7, %N
+  %exitcond29 = icmp eq i32 %add7, 100
   br i1 %exitcond29, label %cleanup, label %for.outer
 
 cleanup:
@@ -202,6 +234,15 @@ cleanup:
 ; CHECK: %j.2 = phi
 ; CHECK: %j.3 = phi
 ;
+; for (i = 0; i < 100; i++) {
+;   A[i] = 1;
+;   sum = 0;
+;   for (j = 0; j < 100; j++) {
+;     sum += B[j] * i;
+;     A[i] = sum;
+;   }
+; }
+;
 ; fore_sub_eq SHOULD be unroll-and-jammed (count=4) as it's safe.
 ; Memory accesses:
 ;   - Fore block: A[i] = 1    (write in outer loop before inner)
@@ -210,10 +251,9 @@ cleanup:
 ; write-after-write (WAW) dependency. However, this is safe for unroll-and-jam
 ; because the execution order is preserved: fore block executes first, then
 ; the entire inner loop (sub block) executes, maintaining the original semantics.
-define void @fore_sub_eq(ptr noalias nocapture %A, i32 %N, ptr noalias nocapture readonly %B) {
+define void @fore_sub_eq(ptr noalias nocapture %A, ptr noalias nocapture readonly %B) {
 entry:
-  %cmp = icmp sgt i32 %N, 0
-  br i1 %cmp, label %for.outer, label %cleanup
+  br label %for.outer
 
 for.outer:
   %i = phi i32 [ %add7, %for.latch ], [ 0, %entry ]
@@ -232,12 +272,12 @@ for.inner:
   %arrayidx8 = getelementptr inbounds i32, ptr %A, i32 %add72
   store i32 %add, ptr %arrayidx8, align 4
   %add6 = add nuw nsw i32 %j, 1
-  %exitcond = icmp eq i32 %add6, %N
+  %exitcond = icmp eq i32 %add6, 100
   br i1 %exitcond, label %for.latch, label %for.inner
 
 for.latch:
   %add7 = add nuw nsw i32 %i, 1
-  %exitcond29 = icmp eq i32 %add7, %N
+  %exitcond29 = icmp eq i32 %add7, 100
   br i1 %exitcond29, label %cleanup, label %for.outer
 
 cleanup:
@@ -249,6 +289,15 @@ cleanup:
 ; CHECK: %j = phi
 ; CHECK-NOT: %j.1 = phi
 ;
+; for (i = 0; i < 100; i++) {
+;   A[i] = 1;
+;   sum = 0;
+;   for (j = 0; j < 100; j++) {
+;     sum += B[j] * i;
+;     A[i+1] = sum;
+;   }
+; }
+;
 ; fore_sub_more should NOT be unroll-and-jammed due to a dependency violation.
 ; Memory accesses:
 ;   - Fore block: A[i] = 1      (write in outer loop before inner)
@@ -257,10 +306,9 @@ cleanup:
 ; When unroll-and-jamming, iteration i's fore block writes A[i] but iteration i's
 ; sub block writes A[i+1]. This conflicts with iteration i+1's fore block write
 ; to A[i+1], creating a write-after-write race condition.
-define void @fore_sub_more(ptr noalias nocapture %A, i32 %N, ptr noalias nocapture readonly %B) {
+define void @fore_sub_more(ptr noalias nocapture %A, ptr noalias nocapture readonly %B) {
 entry:
-  %cmp = icmp sgt i32 %N, 0
-  br i1 %cmp, label %for.outer, label %cleanup
+  br label %for.outer
 
 for.outer:
   %i = phi i32 [ %add7, %for.latch ], [ 0, %entry ]
@@ -279,12 +327,12 @@ for.inner:
   %arrayidx8 = getelementptr inbounds i32, ptr %A, i32 %add72
   store i32 %add, ptr %arrayidx8, align 4
   %add6 = add nuw nsw i32 %j, 1
-  %exitcond = icmp eq i32 %add6, %N
+  %exitcond = icmp eq i32 %add6, 100
   br i1 %exitcond, label %for.latch, label %for.inner
 
 for.latch:
   %add7 = add nuw nsw i32 %i, 1
-  %exitcond29 = icmp eq i32 %add7, %N
+  %exitcond29 = icmp eq i32 %add7, 100
   br i1 %exitcond29, label %cleanup, label %for.outer
 
 cleanup:
@@ -298,6 +346,15 @@ cleanup:
 ; CHECK: %j.2 = phi
 ; CHECK: %j.3 = phi
 ;
+; for (i = 0; i < 100; i++) {
+;   sum = 0;
+;   for (j = 0; j < 100; j++) {
+;     sum += B[j] * i;
+;     A[i] = 1;
+;   }
+;   A[i-1] = sum;
+; }
+;
 ; sub_aft_less SHOULD be unroll-and-jammed (count=4) as it's safe.
 ; Memory accesses:
 ;   - Sub block: A[i] = 1      (write inside inner loop)
@@ -305,10 +362,9 @@ cleanup:
 ; No dependency conflict: The sub block writes A[i] and aft block writes A[i-1].
 ; These access different array elements, so unroll-and-jam is safe. The backward
 ; dependency pattern doesn't create conflicts between unrolled iterations.
-define void @sub_aft_less(ptr noalias nocapture %A, i32 %N, ptr noalias nocapture readonly %B) {
+define void @sub_aft_less(ptr noalias nocapture %A, ptr noalias nocapture readonly %B) {
 entry:
-  %cmp = icmp sgt i32 %N, 0
-  br i1 %cmp, label %for.outer, label %cleanup
+  br label %for.outer
 
 for.outer:
   %i = phi i32 [ %add7, %for.latch ], [ 0, %entry ]
@@ -324,15 +380,15 @@ for.inner:
   %add6 = add nuw nsw i32 %j, 1
   %arrayidx = getelementptr inbounds i32, ptr %A, i32 %i
   store i32 1, ptr %arrayidx, align 4
-  %exitcond = icmp eq i32 %add6, %N
+  %exitcond = icmp eq i32 %add6, 100
   br i1 %exitcond, label %for.latch, label %for.inner
 
 for.latch:
   %add7 = add nuw nsw i32 %i, 1
-  %add72 = add nuw nsw i32 %i, -1
+  %add72 = add nsw i32 %i, -1
   %arrayidx8 = getelementptr inbounds i32, ptr %A, i32 %add72
   store i32 %add, ptr %arrayidx8, align 4
-  %exitcond29 = icmp eq i32 %add7, %N
+  %exitcond29 = icmp eq i32 %add7, 100
   br i1 %exitcond29, label %cleanup, label %for.outer
 
 cleanup:
@@ -346,6 +402,15 @@ cleanup:
 ; CHECK: %j.2 = phi
 ; CHECK: %j.3 = phi
 ;
+; for (i = 0; i < 100; i++) {
+;   sum = 0;
+;   for (j = 0; j < 100; j++) {
+;     sum += B[j] * i;
+;     A[i] = 1;
+;   }
+;   A[i] = sum;
+; }
+;
 ; sub_aft_eq SHOULD be unroll-and-jammed (count=4) as it's safe.
 ; Memory accesses:
 ;   - Sub block: A[i] = 1    (write inside inner loop)
@@ -354,10 +419,9 @@ cleanup:
 ; write-after-write (WAW) dependency. However, this is safe for unroll-and-jam
 ; because the execution order is preserved: the entire inner loop (sub block)
 ; executes first, then the aft block executes, maintaining original semantics.
-define void @sub_aft_eq(ptr noalias nocapture %A, i32 %N, ptr noalias nocapture readonly %B) {
+define void @sub_aft_eq(ptr noalias nocapture %A, ptr noalias nocapture readonly %B) {
 entry:
-  %cmp = icmp sgt i32 %N, 0
-  br i1 %cmp, label %for.outer, label %cleanup
+  br label %for.outer
 
 for.outer:
   %i = phi i32 [ %add7, %for.latch ], [ 0, %entry ]
@@ -373,7 +437,7 @@ for.inner:
   %add6 = add nuw nsw i32 %j, 1
   %arrayidx = getelementptr inbounds i32, ptr %A, i32 %i
   store i32 1, ptr %arrayidx, align 4
-  %exitcond = icmp eq i32 %add6, %N
+  %exitcond = icmp eq i32 %add6, 100
   br i1 %exitcond, label %for.latch, label %for.inner
 
 for.latch:
@@ -381,7 +445,7 @@ for.latch:
   %add72 = add nuw nsw i32 %i, 0
   %arrayidx8 = getelementptr inbounds i32, ptr %A, i32 %i
   store i32 %add, ptr %arrayidx8, align 4
-  %exitcond29 = icmp eq i32 %add7, %N
+  %exitcond29 = icmp eq i32 %add7, 100
   br i1 %exitcond29, label %cleanup, label %for.outer
 
 cleanup:
@@ -393,6 +457,15 @@ cleanup:
 ; CHECK: %j = phi
 ; CHECK-NOT: %j.1 = phi
 ;
+; for (i = 0; i < 100; i++) {
+;   sum = 0;
+;   for (j = 0; j < 100; j++) {
+;     sum += B[j] * i;
+;     A[i] = 1;
+;   }
+;   A[i+1] = sum;
+; }
+;
 ; sub_aft_more should NOT be unroll-and-jammed due to a dependency violation.
 ; Memory accesses:
 ;   - Sub block: A[i] = 1      (write inside inner loop)
@@ -401,10 +474,9 @@ cleanup:
 ; When unroll-and-jamming, iteration i's aft block writes A[i+1] which conflicts
 ; with iteration i+1's sub block write to A[i+1], creating a write-after-write
 ; race condition that violates the original sequential semantics.
-define void @sub_aft_more(ptr noalias nocapture %A, i32 %N, ptr noalias nocapture readonly %B) {
+define void @sub_aft_more(ptr noalias nocapture %A, ptr noalias nocapture readonly %B) {
 entry:
-  %cmp = icmp sgt i32 %N, 0
-  br i1 %cmp, label %for.outer, label %cleanup
+  br label %for.outer
 
 for.outer:
   %i = phi i32 [ %add7, %for.latch ], [ 0, %entry ]
@@ -420,7 +492,7 @@ for.inner:
   %add6 = add nuw nsw i32 %j, 1
   %arrayidx = getelementptr inbounds i32, ptr %A, i32 %i
   store i32 1, ptr %arrayidx, align 4
-  %exitcond = icmp eq i32 %add6, %N
+  %exitcond = icmp eq i32 %add6, 100
   br i1 %exitcond, label %for.latch, label %for.inner
 
 for.latch:
@@ -428,7 +500,7 @@ for.latch:
   %add72 = add nuw nsw i32 %i, 1
   %arrayidx8 = getelementptr inbounds i32, ptr %A, i32 %add72
   store i32 %add, ptr %arrayidx8, align 4
-  %exitcond29 = icmp eq i32 %add7, %N
+  %exitcond29 = icmp eq i32 %add7, 100
   br i1 %exitcond29, label %cleanup, label %for.outer
 
 cleanup:
@@ -440,6 +512,15 @@ cleanup:
 ; CHECK: %j = phi
 ; CHECK-NOT: %j.1 = phi
 ;
+; for (i = 0; i < 100; i++) {
+;   sum = 0;
+;   for (j = 0; j < 100; j++) {
+;     sum += B[j] * i;
+;     A[i] = 1;
+;     A[i-1] = sum;
+;   }
+; }
+;
 ; sub_sub_less should NOT be unroll-and-jammed due to a dependency violation.
 ; Memory accesses:
 ;   - Sub block: A[i] = 1      (write inside inner loop)
@@ -448,10 +529,9 @@ cleanup:
 ; A[i] and A[i-1]. When unroll-and-jamming, the inner loop is jammed, meaning
 ; iterations of the inner loop from different outer iterations execute together.
 ; This creates a backward dependency that can cause race conditions.
-define void @sub_sub_less(ptr noalias nocapture %A, i32 %N, ptr noalias nocapture readonly %B) {
+define void @sub_sub_less(ptr noalias nocapture %A, ptr noalias nocapture readonly %B) {
 entry:
-  %cmp = icmp sgt i32 %N, 0
-  br i1 %cmp, label %for.outer, label %cleanup
+  br label %for.outer
 
 for.outer:
   %i = phi i32 [ %add7, %for.latch ], [ 0, %entry ]
@@ -467,15 +547,15 @@ for.inner:
   %add6 = add nuw nsw i32 %j, 1
   %arrayidx = getelementptr inbounds i32, ptr %A, i32 %i
   store i32 1, ptr %arrayidx, align 4
-  %add72 = add nuw nsw i32 %i, -1
+  %add72 = add nsw i32 %i, -1
   %arrayidx8 = getelementptr inbounds i32, ptr %A, i32 %add72
   store i32 %add, ptr %arrayidx8, align 4
-  %exitcond = icmp eq i32 %add6, %N
+  %exitcond = icmp eq i32 %add6, 100
   br i1 %exitcond, label %for.latch, label %for.inner
 
 for.latch:
   %add7 = add nuw nsw i32 %i, 1
-  %exitcond29 = icmp eq i32 %add7, %N
+  %exitcond29 = icmp eq i32 %add7, 100
   br i1 %exitcond29, label %cleanup, label %for.outer
 
 cleanup:
@@ -489,6 +569,15 @@ cleanup:
 ; CHECK: %j.2 = phi
 ; CHECK: %j.3 = phi
 ;
+; for (i = 0; i < 100; i++) {
+;   sum = 0;
+;   for (j = 0; j < 100; j++) {
+;     sum += B[j] * i;
+;     A[i] = 1;
+;     A[i] = sum;
+;   }
+; }
+;
 ; sub_sub_eq SHOULD be unroll-and-jammed (count=4) as it's safe.
 ; Memory accesses:
 ;   - Sub block: A[i] = 1    (write inside inner loop)
@@ -497,10 +586,9 @@ cleanup:
 ; write-after-write (WAW) dependency. However, this is safe for unroll-and-jam
 ; because both writes are in the same basic block and maintain their relative
 ; order: A[i] = 1 always executes before A[i] = sum in each iteration.
-define void @sub_sub_eq(ptr noalias nocapture %A, i32 %N, ptr noalias nocapture readonly %B) {
+define void @sub_sub_eq(ptr noalias nocapture %A, ptr noalias nocapture readonly %B) {
 entry:
-  %cmp = icmp sgt i32 %N, 0
-  br i1 %cmp, label %for.outer, label %cleanup
+  br label %for.outer
 
 for.outer:
   %i = phi i32 [ %add7, %for.latch ], [ 0, %entry ]
@@ -519,12 +607,12 @@ for.inner:
   %add72 = add nuw nsw i32 %i, 0
   %arrayidx8 = getelementptr inbounds i32, ptr %A, i32 %add72
   store i32 %add, ptr %arrayidx8, align 4
-  %exitcond = icmp eq i32 %add6, %N
+  %exitcond = icmp eq i32 %add6, 100
   br i1 %exitcond, label %for.latch, label %for.inner
 
 for.latch:
   %add7 = add nuw nsw i32 %i, 1
-  %exitcond29 = icmp eq i32 %add7, %N
+  %exitcond29 = icmp eq i32 %add7, 100
   br i1 %exitcond29, label %cleanup, label %for.outer
 
 cleanup:
@@ -536,6 +624,15 @@ cleanup:
 ; CHECK: %j = phi
 ; CHECK-NOT: %j.1 = phi
 ;
+; for (i = 0; i < 100; i++) {
+;   sum = 0;
+;   for (j = 0; j < 100; j++) {
+;     sum += B[j] * i;
+;     A[i] = 1;
+;     A[i+1] = sum;
+;   }
+; }
+;
 ; sub_sub_more should NOT be unroll-and-jammed due to a dependency violation.
 ; Memory accesses:
 ;   - Sub block: A[i] = 1      (write inside inner loop)
@@ -544,10 +641,9 @@ cleanup:
 ; When unroll-and-jamming, iteration i's sub block writes A[i+1] which conflicts
 ; with iteration i+1's sub block write to A[i+1]. This creates a forward
 ; dependency that causes write-after-write race conditions.
-define void @sub_sub_more(ptr noalias nocapture %A, i32 %N, ptr noalias nocapture readonly %B) {
+define void @sub_sub_more(ptr noalias nocapture %A, ptr noalias nocapture readonly %B) {
 entry:
-  %cmp = icmp sgt i32 %N, 0
-  br i1 %cmp, label %for.outer, label %cleanup
+  br label %for.outer
 
 for.outer:
   %i = phi i32 [ %add7, %for.latch ], [ 0, %entry ]
@@ -566,12 +662,12 @@ for.inner:
   %add72 = add nuw nsw i32 %i, 1
   %arrayidx8 = getelementptr inbounds i32, ptr %A, i32 %add72
   store i32 %add, ptr %arrayidx8, align 4
-  %exitcond = icmp eq i32 %add6, %N
+  %exitcond = icmp eq i32 %add6, 100
   br i1 %exitcond, label %for.latch, label %for.inner
 
 for.latch:
   %add7 = add nuw nsw i32 %i, 1
-  %exitcond29 = icmp eq i32 %add7, %N
+  %exitcond29 = icmp eq i32 %add7, 100
   br i1 %exitcond29, label %cleanup, label %for.outer
 
 cleanup:

``````````

</details>


https://github.com/llvm/llvm-project/pull/183509


More information about the llvm-commits mailing list