[llvm] [LAA] Enable diff checks for non-unit constant stride (PR #188826)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 4 07:55:52 PDT 2026
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions h,cpp -- llvm/include/llvm/Analysis/LoopAccessAnalysis.h llvm/lib/Analysis/LoopAccessAnalysis.cpp llvm/lib/Transforms/Utils/LoopUtils.cpp llvm/lib/Transforms/Vectorize/LoopVectorize.cpp llvm/lib/Transforms/Vectorize/VPlanLowering.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/lib/Transforms/Utils/LoopUtils.cpp b/llvm/lib/Transforms/Utils/LoopUtils.cpp
index d3a1d1974..d5d940a71 100644
--- a/llvm/lib/Transforms/Utils/LoopUtils.cpp
+++ b/llvm/lib/Transforms/Utils/LoopUtils.cpp
@@ -2295,8 +2295,8 @@ Value *llvm::addDiffRuntimeChecks(
// Cache of (VF*IC*Stride-(Stride-AccessSize)) - 1, shared across checks with
// matching type/IC/Stride to avoid emitting duplicate runtime computations.
DenseMap<
- std::tuple<Type *, unsigned /*IC*/,
- uint64_t /*AbsCommonStrideInBytes*/, unsigned /*AccessSize*/>,
+ std::tuple<Type *, unsigned /*IC*/, uint64_t /*AbsCommonStrideInBytes*/,
+ unsigned /*AccessSize*/>,
Value *>
ThresholdCache;
for (const auto &[SrcStart, SinkStart, AccessSize, AbsCommonStrideInBytes,
@@ -2316,15 +2316,14 @@ Value *llvm::addDiffRuntimeChecks(
Ty = Ty->getWithNewBitWidth(
NextPowerOf2(ICTimesStride.getActiveBits() - 1));
-
Value *&ThresholdMinusOne =
ThresholdCache[{Ty, IC, AbsCommonStrideInBytes, AccessSize}];
if (!ThresholdMinusOne)
ThresholdMinusOne = ChkBuilder.CreateSub(
- ChkBuilder.CreateMul(GetVF(ChkBuilder, Ty->getScalarSizeInBits()),
- ConstantInt::get(
- Ty, ICTimesStride.zextOrTrunc(
- Ty->getScalarSizeInBits()))),
+ ChkBuilder.CreateMul(
+ GetVF(ChkBuilder, Ty->getScalarSizeInBits()),
+ ConstantInt::get(
+ Ty, ICTimesStride.zextOrTrunc(Ty->getScalarSizeInBits()))),
ConstantInt::get(Ty, AbsCommonStrideInBytes - AccessSize + 1));
Value *Diff = Expander.expandCodeFor(
``````````
</details>
https://github.com/llvm/llvm-project/pull/188826
More information about the llvm-commits
mailing list