[llvm] [VPlan] Determine WidenGEP::usesFirstLaneOnly cheaply (NFCI) (PR #195087)

via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 30 07:00:19 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-transforms

Author: Ramkumar Ramachandra (artagnon)

<details>
<summary>Changes</summary>

Using vputils::isSingleScalar to determine if only the first lane of an operand is wasteful, considering that all operands are integers with the exception of the first operand, which is a pointer: these will be maximally narrowed by narrowToSingleScalars.

---
Full diff: https://github.com/llvm/llvm-project/pull/195087.diff


1 Files Affected:

- (modified) llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp (+1-1) 


``````````diff
diff --git a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
index 7008340cb5522..67e252f6b14d1 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
@@ -2608,7 +2608,7 @@ void VPScalarIVStepsRecipe::printRecipe(raw_ostream &O, const Twine &Indent,
 
 bool VPWidenGEPRecipe::usesFirstLaneOnly(const VPValue *Op) const {
   assert(is_contained(operands(), Op) && "Op must be an operand of the recipe");
-  return vputils::isSingleScalar(Op);
+  return Op->isDefinedOutsideLoopRegions();
 }
 
 void VPWidenGEPRecipe::execute(VPTransformState &State) {

``````````

</details>


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


More information about the llvm-commits mailing list