Skip to content

[LV] Add iv_outside_user ptr-ind variant test - #213263

Merged
artagnon merged 1 commit into
llvm:mainfrom
artagnon:vplan-iv-outside-user-ptr-ind-test
Aug 3, 2026
Merged

[LV] Add iv_outside_user ptr-ind variant test#213263
artagnon merged 1 commit into
llvm:mainfrom
artagnon:vplan-iv-outside-user-ptr-ind-test

Conversation

@artagnon

Copy link
Copy Markdown
Contributor

There was previously a doubt about whether the integer variant of the test should use wrap-flags on the latch exit value, which motivates us to add coverage for the ptr variant.

@llvmorg-github-actions

Copy link
Copy Markdown

@llvm/pr-subscribers-llvm-transforms

Author: Ramkumar Ramachandra (artagnon)

Changes

There was previously a doubt about whether the integer variant of the test should use wrap-flags on the latch exit value, which motivates us to add coverage for the ptr variant.


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

1 Files Affected:

  • (modified) llvm/test/Transforms/LoopVectorize/iv_outside_user.ll (+35)
diff --git a/llvm/test/Transforms/LoopVectorize/iv_outside_user.ll b/llvm/test/Transforms/LoopVectorize/iv_outside_user.ll
index fb85fda0177b8..cc2d2a2308a19 100644
--- a/llvm/test/Transforms/LoopVectorize/iv_outside_user.ll
+++ b/llvm/test/Transforms/LoopVectorize/iv_outside_user.ll
@@ -677,6 +677,41 @@ for.end:
   ret i32 %inc.2
 }
 
+define ptr @postinc_not_iv_backedge_value_ptr_induction(ptr %p.init)  {
+; CHECK-LABEL: define ptr @postinc_not_iv_backedge_value_ptr_induction(
+; CHECK-SAME: ptr [[P_INIT:%.*]]) {
+; CHECK-NEXT:  [[ENTRY:.*:]]
+; CHECK-NEXT:    [[P_END:%.*]] = getelementptr nusw nuw i8, ptr [[P_INIT]], i64 1024
+; CHECK-NEXT:    br label %[[VECTOR_PH:.*]]
+; CHECK:       [[VECTOR_PH]]:
+; CHECK-NEXT:    br label %[[VECTOR_BODY:.*]]
+; CHECK:       [[VECTOR_BODY]]:
+; CHECK-NEXT:    [[INDEX:%.*]] = phi i64 [ 0, %[[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], %[[VECTOR_BODY]] ]
+; CHECK-NEXT:    [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 2
+; CHECK-NEXT:    [[TMP0:%.*]] = icmp eq i64 [[INDEX_NEXT]], 1024
+; CHECK-NEXT:    br i1 [[TMP0]], label %[[MIDDLE_BLOCK:.*]], label %[[VECTOR_BODY]], {{!llvm.loop ![0-9]+}}
+; CHECK:       [[MIDDLE_BLOCK]]:
+; CHECK-NEXT:    [[TMP1:%.*]] = getelementptr i8, ptr [[P_INIT]], i64 2
+; CHECK-NEXT:    [[TMP2:%.*]] = getelementptr i8, ptr [[TMP1]], i64 1023
+; CHECK-NEXT:    br label %[[END:.*]]
+; CHECK:       [[END]]:
+; CHECK-NEXT:    ret ptr [[TMP2]]
+;
+entry:
+  %p.end = getelementptr nuw nusw i8, ptr %p.init, i64 1024
+  br label %loop
+
+loop:
+  %p.iv = phi ptr [ %p.init, %entry ], [ %p.next, %loop ]
+  %p.next = getelementptr nuw i8, ptr %p.iv, i64 1
+  %ret = getelementptr i8, ptr %p.iv, i64 2
+  %ec = icmp eq ptr %p.next, %p.end
+  br i1 %ec, label %end, label %loop
+
+end:
+  ret ptr %ret
+}
+
 define float @fp_postinc_use_fadd(float %init, ptr noalias nocapture %A, i64 %N, float %fpinc) {
 ; VEC-LABEL: define float @fp_postinc_use_fadd(
 ; VEC-SAME: float [[INIT:%.*]], ptr noalias captures(none) [[A:%.*]], i64 [[N:%.*]], float [[FPINC:%.*]]) {

@fhahn fhahn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, thanks

There was previously a doubt about whether the integer variant of the
test should use wrap-flags on the latch exit value, which motivates us
to add coverage for the ptr variant.
@artagnon
artagnon force-pushed the vplan-iv-outside-user-ptr-ind-test branch from ff8c90f to 1c439cb Compare August 3, 2026 07:34
@artagnon
artagnon enabled auto-merge (squash) August 3, 2026 07:34
@artagnon
artagnon merged commit a9ebf2c into llvm:main Aug 3, 2026
10 of 12 checks passed
@artagnon
artagnon deleted the vplan-iv-outside-user-ptr-ind-test branch August 3, 2026 08:20
frederik-h pushed a commit to frederik-h/llvm-project that referenced this pull request Aug 3, 2026
There was previously a doubt about whether the integer variant of the
test should use wrap-flags on the latch exit value, which motivates us
to add coverage for the ptr variant.
jgreenbaum pushed a commit to jgreenbaum/llvm-project that referenced this pull request Aug 3, 2026
There was previously a doubt about whether the integer variant of the
test should use wrap-flags on the latch exit value, which motivates us
to add coverage for the ptr variant.
tfzee pushed a commit to tfzee/llvm-project that referenced this pull request Aug 6, 2026
There was previously a doubt about whether the integer variant of the
test should use wrap-flags on the latch exit value, which motivates us
to add coverage for the ptr variant.
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.

2 participants