[llvm] [VPlan] Optimize FindLast of (binop %IV, live-in) by sinking. (PR #183911)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 3 15:09:04 PST 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 cpp -- llvm/lib/Transforms/Vectorize/VPlanTransforms.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/Vectorize/VPlanTransforms.cpp b/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
index c5b5c096f..1b55c0246 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
@@ -5680,7 +5680,7 @@ getExpressionIV(VPValue *V, VPRegionBlock *VectorLoopRegion) {
std::swap(Op0, Op1);
if (!Op1->isDefinedOutsideLoopRegions())
- return nullptr;
+ return nullptr;
return dyn_cast<VPWidenIntOrFpInductionRecipe>(Op0);
}
@@ -5694,7 +5694,7 @@ static VPValue *sinkBinOpToMiddleBlock(VPValue *V, VPValue *ScalarIV,
if (BinOp->getOperand(0) == WidenIV)
BinOp->setOperand(0, ScalarIV);
else {
- assert(BinOp->getOperand(1) == WidenIV && "one operand must be WideIV");
+ assert(BinOp->getOperand(1) == WidenIV && "one operand must be WideIV");
BinOp->setOperand(1, ScalarIV);
}
BinOp->insertBefore(*InsertPt->getParent(), InsertPt);
@@ -5751,9 +5751,9 @@ void VPlanTransforms::optimizeFindIVReductions(VPlan &Plan,
assert(is_contained(CondSelect->getDefiningRecipe()->operands(), PhiR));
VPValue *ExprOfIV = TrueVal == PhiR ? FalseVal : TrueVal;
- // Check if IV is a simple expression of a widened IV. If so, we can track the underlying IV and sink the expression.
- auto *ExpressionIV =
- getExpressionIV(ExprOfIV, VectorLoopRegion);
+ // Check if IV is a simple expression of a widened IV. If so, we can track
+ // the underlying IV and sink the expression.
+ auto *ExpressionIV = getExpressionIV(ExprOfIV, VectorLoopRegion);
const SCEV *IVSCEV = vputils::getSCEVExprForVPValue(
ExpressionIV ? ExpressionIV : ExprOfIV, PSE, &L);
const SCEV *Step;
``````````
</details>
https://github.com/llvm/llvm-project/pull/183911
More information about the llvm-commits
mailing list