[llvm] [LAA] Rework getStrideFromPointer, speculate more (PR #212816)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 3 05:22:04 PDT 2026


================
@@ -225,8 +226,19 @@ define void @test_versioned_with_different_uses(i32 %offset, ptr noalias %dst.1,
 ; CHECK:       inner.loop.preheader:
 ; CHECK-NEXT:    br label [[VECTOR_SCEVCHECK:%.*]]
 ; CHECK:       vector.scevcheck:
+; CHECK-NEXT:    [[TMP1:%.*]] = icmp slt i32 [[OFFSET]], 0
+; CHECK-NEXT:    [[TMP2:%.*]] = select i1 [[TMP1]], i32 [[TMP0]], i32 [[OFFSET]]
+; CHECK-NEXT:    [[MUL:%.*]] = call { i32, i1 } @llvm.umul.with.overflow.i32(i32 [[TMP2]], i32 200)
----------------
artagnon wrote:

I think so, it corresponds to:

```llvm
[[IND_END:%.*]] = add i64 [[IV_1]], 200
```

I think what's happening here is that we now get the right Stride expression underlying the cast:

```llvm
 [[OFFSET_IDX2:%.*]] = trunc i64 [[INDEX]] to i32
```

and add the SCEV predicates correctly? Will add this test as a pre-commit to LAA, and show the output shortly.

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


More information about the llvm-commits mailing list