[llvm] [LoopVectorize] Widen selected-base loads with masked loads (PR #213227)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 3 23:49:26 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/lib/Transforms/Vectorize/LoopVectorizationPlanner.h llvm/lib/Transforms/Vectorize/VPlan.h llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h 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/VPlanPatternMatch.h b/llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h
index 7a2a5cdb0..b93914728 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h
+++ b/llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h
@@ -1157,10 +1157,9 @@ struct SelectedBaseLoad_match {
VPValue *Cond = nullptr;
VPValue *TrueBase = nullptr;
VPValue *FalseBase = nullptr;
- if (!VPlanPatternMatch::match(
- GEPOperands.front(),
- m_Select(m_VPValue(Cond), m_VPValue(TrueBase),
- m_VPValue(FalseBase))) ||
+ if (!VPlanPatternMatch::match(GEPOperands.front(),
+ m_Select(m_VPValue(Cond), m_VPValue(TrueBase),
+ m_VPValue(FalseBase))) ||
!Cond->getScalarType()->isIntegerTy(1) || TrueBase == FalseBase)
return false;
diff --git a/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp b/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
index d45500510..61a30bfab 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
@@ -12,6 +12,7 @@
//===----------------------------------------------------------------------===//
#include "VPlanTransforms.h"
+#include "SLPVectorizer/SLPCostAnalysis.h"
#include "VPRecipeBuilder.h"
#include "VPlan.h"
#include "VPlanAnalysis.h"
@@ -20,7 +21,6 @@
#include "VPlanHelpers.h"
#include "VPlanPatternMatch.h"
#include "VPlanUtils.h"
-#include "SLPVectorizer/SLPCostAnalysis.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/PostOrderIterator.h"
#include "llvm/ADT/STLExtras.h"
@@ -5499,14 +5499,12 @@ void VPlanTransforms::makeMemOpWideningDecisions(VPlan &Plan, VFRange &Range,
return false;
Type *VecTy = VectorType::get(ScalarTy, VF);
InstructionCost BlendedCost = slpvectorizer::getBlendedLoadCost(
- CostCtx.TTI, VecTy, SplitAlignment,
- LI->getPointerAddressSpace(), CostCtx.CostKind);
+ CostCtx.TTI, VecTy, SplitAlignment, LI->getPointerAddressSpace(),
+ CostCtx.CostKind);
if (HasActiveMask) {
Type *MaskTy = CmpInst::makeCmpResultType(VecTy);
- BlendedCost +=
- 2 * CostCtx.TTI.getArithmeticInstrCost(Instruction::And,
- MaskTy,
- CostCtx.CostKind);
+ BlendedCost += 2 * CostCtx.TTI.getArithmeticInstrCost(
+ Instruction::And, MaskTy, CostCtx.CostKind);
}
// Reuse the legacy decision's cost. This is the gather cost for the
// usual case, but also keeps the comparison correct if the legacy
``````````
</details>
https://github.com/llvm/llvm-project/pull/213227
More information about the llvm-commits
mailing list