[llvm] [LoopPeel] Peel last iteration to enable load widening (PR #173420)
via llvm-commits
llvm-commits at lists.llvm.org
Sun May 10 04:01:39 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/IR/DataLayout.h llvm/include/llvm/Transforms/Utils/LoopPeel.h llvm/include/llvm/Transforms/Utils/UnrollLoop.h llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp llvm/lib/Transforms/Utils/LoopPeel.cpp llvm/lib/Transforms/Vectorize/VectorCombine.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/Scalar/LoopUnrollPass.cpp b/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
index 585d6799d..184282247 100644
--- a/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
@@ -1033,18 +1033,15 @@ shouldPartialUnroll(const unsigned LoopSize, const unsigned TripCount,
// FIXME: This function is used by LoopUnroll and LoopUnrollAndJam, but consumes
// many LoopUnroll-specific options. The shared functionality should be
// refactored into it own function.
-void llvm::computeUnrollCount(Loop *L, const TargetTransformInfo &TTI,
- DominatorTree &DT, LoopInfo *LI,
- AssumptionCache *AC, ScalarEvolution &SE,
- const SmallPtrSetImpl<const Value *> &EphValues,
- OptimizationRemarkEmitter *ORE,
- const unsigned TripCount,
- const unsigned MaxTripCount, const bool MaxOrZero,
- const unsigned TripMultiple,
- const UnrollCostEstimator &UCE,
- TargetTransformInfo::UnrollingPreferences &UP,
- TargetTransformInfo::PeelingPreferences &PP,
- bool AllowLoadWideningPeel) {
+void llvm::computeUnrollCount(
+ Loop *L, const TargetTransformInfo &TTI, DominatorTree &DT, LoopInfo *LI,
+ AssumptionCache *AC, ScalarEvolution &SE,
+ const SmallPtrSetImpl<const Value *> &EphValues,
+ OptimizationRemarkEmitter *ORE, const unsigned TripCount,
+ const unsigned MaxTripCount, const bool MaxOrZero,
+ const unsigned TripMultiple, const UnrollCostEstimator &UCE,
+ TargetTransformInfo::UnrollingPreferences &UP,
+ TargetTransformInfo::PeelingPreferences &PP, bool AllowLoadWideningPeel) {
unsigned LoopSize = UCE.getRolledLoopSize();
@@ -1150,7 +1147,8 @@ void llvm::computeUnrollCount(Loop *L, const TargetTransformInfo &TTI,
// 5th priority is loop peeling.
LLVM_DEBUG(dbgs().indent(1) << "Trying loop peeling...\n");
- computePeelCount(L, LoopSize, PP, TripCount, DT, SE, TTI, AC, UP.Threshold, AllowLoadWideningPeel);
+ computePeelCount(L, LoopSize, PP, TripCount, DT, SE, TTI, AC, UP.Threshold,
+ AllowLoadWideningPeel);
if (PP.PeelCount) {
LLVM_DEBUG(dbgs().indent(2)
<< "Peeling with count: " << PP.PeelCount << ".\n");
@@ -1420,7 +1418,8 @@ tryToUnrollLoop(Loop *L, DominatorTree &DT, LoopInfo *LI, ScalarEvolution &SE,
// fully unroll the loop.
bool AllowLoadWideningPeel = !OnlyFullUnroll;
computeUnrollCount(L, TTI, DT, LI, &AC, SE, EphValues, &ORE, TripCount,
- MaxTripCount, MaxOrZero, TripMultiple, UCE, UP, PP, AllowLoadWideningPeel);
+ MaxTripCount, MaxOrZero, TripMultiple, UCE, UP, PP,
+ AllowLoadWideningPeel);
if (!UP.Count) {
LLVM_DEBUG(dbgs().indent(1)
<< "Not unrolling: no viable strategy found.\n");
``````````
</details>
https://github.com/llvm/llvm-project/pull/173420
More information about the llvm-commits
mailing list