[llvm-branch-commits] [llvm] release/22.x: [LoopVectorize] Fix nondeterminism in loop-vectorize (#200833) (PR #203850)

Orlando Cazalet-Hyams via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Jun 16 03:57:41 PDT 2026


OCHyams wrote:

What's the process for patching a backport request?  The test fails due to slightly different IR generated between main and llvm22
```
diff --git a/llvm/test/Transforms/LoopVectorize/X86/nondetermisitic-widening-cost.ll b/llvm/test/Transforms/LoopVectorize/X86/nondetermisitic-widening-cost.ll
index b99322c0ce924..f326f52ee1e34 100644
--- a/llvm/test/Transforms/LoopVectorize/X86/nondetermisitic-widening-cost.ll
+++ b/llvm/test/Transforms/LoopVectorize/X86/nondetermisitic-widening-cost.ll
@@ -23,6 +23,7 @@ define float @fun(i64 %0, float %1, ptr noalias  %a, ptr noalias %b, i64 %len) #
 ; CHECK-NEXT:    br label %[[VECTOR_BODY:.*]]
 ; CHECK:       [[VECTOR_BODY]]:
 ; CHECK-NEXT:    [[INDEX:%.*]] = phi i64 [ 0, %[[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], %[[VECTOR_BODY]] ]
+; CHECK-NEXT:    [[TMP5:%.*]] = add i64 [[INDEX]], 0
 ; CHECK-NEXT:    [[TMP6:%.*]] = add i64 [[INDEX]], 1
 ; CHECK-NEXT:    [[TMP7:%.*]] = add i64 [[INDEX]], 2
 ; CHECK-NEXT:    [[TMP8:%.*]] = add i64 [[INDEX]], 3
@@ -30,7 +31,7 @@ define float @fun(i64 %0, float %1, ptr noalias  %a, ptr noalias %b, i64 %len) #
 ; CHECK-NEXT:    [[TMP12:%.*]] = add i64 [[INDEX]], 5
 ; CHECK-NEXT:    [[TMP9:%.*]] = add i64 [[INDEX]], 6
 ; CHECK-NEXT:    [[TMP10:%.*]] = add i64 [[INDEX]], 7
-; CHECK-NEXT:    [[TMP48:%.*]] = getelementptr [8 x i8], ptr [[A]], i64 [[INDEX]]
+; CHECK-NEXT:    [[TMP48:%.*]] = getelementptr [8 x i8], ptr [[A]], i64 [[TMP5]]
 ; CHECK-NEXT:    [[TMP49:%.*]] = getelementptr [8 x i8], ptr [[A]], i64 [[TMP6]]
 ; CHECK-NEXT:    [[TMP50:%.*]] = getelementptr [8 x i8], ptr [[A]], i64 [[TMP7]]
 ; CHECK-NEXT:    [[TMP51:%.*]] = getelementptr [8 x i8], ptr [[A]], i64 [[TMP8]]
@@ -78,11 +79,11 @@ define float @fun(i64 %0, float %1, ptr noalias  %a, ptr noalias %b, i64 %len) #
 ; CHECK-NEXT:    [[TMP76:%.*]] = insertelement <4 x float> [[TMP75]], float [[TMP72]], i32 1
 ; CHECK-NEXT:    [[TMP77:%.*]] = insertelement <4 x float> [[TMP76]], float [[TMP73]], i32 2
 ; CHECK-NEXT:    [[TMP78:%.*]] = insertelement <4 x float> [[TMP77]], float [[TMP74]], i32 3
-; CHECK-NEXT:    [[TMP61:%.*]] = getelementptr [4 x i8], ptr [[VLA]], i64 [[INDEX]]
+; CHECK-NEXT:    [[TMP61:%.*]] = getelementptr [4 x i8], ptr [[VLA]], i64 [[TMP5]]
 ; CHECK-NEXT:    [[TMP79:%.*]] = getelementptr float, ptr [[TMP61]], i64 4
 ; CHECK-NEXT:    store <4 x float> [[TMP59]], ptr [[TMP61]], align 4
 ; CHECK-NEXT:    store <4 x float> [[TMP78]], ptr [[TMP79]], align 4
-; CHECK-NEXT:    [[TMP63:%.*]] = getelementptr [4 x i8], ptr [[TMP4]], i64 [[INDEX]]
+; CHECK-NEXT:    [[TMP63:%.*]] = getelementptr [4 x i8], ptr [[TMP4]], i64 [[TMP5]]
 ; CHECK-NEXT:    [[TMP80:%.*]] = getelementptr float, ptr [[TMP63]], i64 4
 ; CHECK-NEXT:    store <4 x float> [[BROADCAST_SPLAT]], ptr [[TMP63]], align 4
 ; CHECK-NEXT:    store <4 x float> [[BROADCAST_SPLAT]], ptr [[TMP80]], align 4
 ```


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


More information about the llvm-branch-commits mailing list