[polly] 710d0c3 - [Polly][NFC] Fix loop index in C comments of tests with nested loops (#220589)

via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 15 01:46:54 PDT 2026


Author: Timur Baidusenov
Date: 2026-09-15T10:46:49+02:00
New Revision: 710d0c3ee1689e5cfb029ab0e6fd7be0e14fcb73

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

LOG: [Polly][NFC] Fix loop index in C comments of tests with nested loops (#220589)

The C pseudo-code in tests declares `long i, j`, but the inner loop
reuses `i` instead of `j`, which would overwrite the outer loop counter
and describe a different program than the IR below it.

Added: 
    

Modified: 
    polly/test/ScopDetect/simple_loop_with_param.ll
    polly/test/ScopDetect/simple_loop_with_param_2.ll
    polly/test/ScopInfo/inter_bb_scalar_dep.ll
    polly/test/ScopInfo/intra_and_inter_bb_scalar_dep.ll
    polly/test/ScopInfo/intra_bb_scalar_dep.ll
    polly/test/ScopInfo/tempscop-printing.ll

Removed: 
    


################################################################################
diff  --git a/polly/test/ScopDetect/simple_loop_with_param.ll b/polly/test/ScopDetect/simple_loop_with_param.ll
index 67f677892313c..88fbb2296c3f5 100644
--- a/polly/test/ScopDetect/simple_loop_with_param.ll
+++ b/polly/test/ScopDetect/simple_loop_with_param.ll
@@ -2,14 +2,14 @@
 
 ; void f(long A[], long N, long *init_ptr) {
 ;   long i, j;
-;   long i_non_canonical;
+;   long j_non_canonical;
 ;
 ;   for (i = 0; i < N; ++i) {
 ;     init = *init_ptr;
-;     i_non_canonical = init;
-;     for (i = 0; i < N; ++i) {
-;       A[i] = i_non_canonical;
-;       i_non_canonical += 1;
+;     j_non_canonical = init;
+;     for (j = 0; j < N; ++j) {
+;       A[j] = j_non_canonical;
+;       j_non_canonical += 1;
 ;     }
 ;   }
 ; }

diff  --git a/polly/test/ScopDetect/simple_loop_with_param_2.ll b/polly/test/ScopDetect/simple_loop_with_param_2.ll
index 9e7b55efc48d9..75accb82c6a18 100644
--- a/polly/test/ScopDetect/simple_loop_with_param_2.ll
+++ b/polly/test/ScopDetect/simple_loop_with_param_2.ll
@@ -5,8 +5,8 @@
 ;
 ;   for (i = 0; i < N; ++i) {
 ;     init = *init_ptr;
-;     for (i = 0; i < N; ++i) {
-;       A[i] = init + 2;
+;     for (j = 0; j < N; ++j) {
+;       A[j] = init + 2;
 ;     }
 ;   }
 ; }

diff  --git a/polly/test/ScopInfo/inter_bb_scalar_dep.ll b/polly/test/ScopInfo/inter_bb_scalar_dep.ll
index f6406640dd2d8..4e207fb4afd09 100644
--- a/polly/test/ScopInfo/inter_bb_scalar_dep.ll
+++ b/polly/test/ScopInfo/inter_bb_scalar_dep.ll
@@ -5,8 +5,8 @@
 ;
 ;   for (i = 0; i < N; ++i) {
 ;     init = *init_ptr;
-;     for (i = 0; i < N; ++i) {
-;       A[i] = init + 2;
+;     for (j = 0; j < N; ++j) {
+;       A[j] = init + 2;
 ;     }
 ;   }
 ; }

diff  --git a/polly/test/ScopInfo/intra_and_inter_bb_scalar_dep.ll b/polly/test/ScopInfo/intra_and_inter_bb_scalar_dep.ll
index b0b63658caa55..62e98a606eff5 100644
--- a/polly/test/ScopInfo/intra_and_inter_bb_scalar_dep.ll
+++ b/polly/test/ScopInfo/intra_and_inter_bb_scalar_dep.ll
@@ -5,9 +5,9 @@
 ;
 ;   for (i = 0; i < N; ++i) {
 ;     init = *init_ptr;
-;     for (i = 0; i < N; ++i) {
+;     for (j = 0; j < N; ++j) {
 ;       init2 = *init_ptr;
-;       A[i] = init + init2;
+;       A[j] = init + init2;
 ;     }
 ;   }
 ; }

diff  --git a/polly/test/ScopInfo/intra_bb_scalar_dep.ll b/polly/test/ScopInfo/intra_bb_scalar_dep.ll
index 0ef6b2d35106b..b7746ae019b0e 100644
--- a/polly/test/ScopInfo/intra_bb_scalar_dep.ll
+++ b/polly/test/ScopInfo/intra_bb_scalar_dep.ll
@@ -4,9 +4,9 @@
 ;   long i, j;
 ;
 ;   for (i = 0; i < N; ++i) {
-;     for (i = 0; i < N; ++i) {
+;     for (j = 0; j < N; ++j) {
 ;       init = *init_ptr;
-;       A[i] = init + 2;
+;       A[j] = init + 2;
 ;     }
 ;   }
 ; }

diff  --git a/polly/test/ScopInfo/tempscop-printing.ll b/polly/test/ScopInfo/tempscop-printing.ll
index 09cc95e42a584..58897ab37ac61 100644
--- a/polly/test/ScopInfo/tempscop-printing.ll
+++ b/polly/test/ScopInfo/tempscop-printing.ll
@@ -5,8 +5,8 @@
 ;
 ;   for (i = 0; i < N; ++i) {
 ;     init = *init_ptr;
-;     for (i = 0; i < N; ++i) {
-;       A[i] = init + 2;
+;     for (j = 0; j < N; ++j) {
+;       A[j] = init + 2;
 ;     }
 ;   }
 ; }


        


More information about the llvm-commits mailing list