[llvm] d3e1094 - [VPlan] Implement VPCanonicalIVPHIRecipe::onlyFirstLaneUsed.

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 11 10:07:46 PST 2022


Author: Florian Hahn
Date: 2022-03-11T18:07:26Z
New Revision: d3e10944730bd8b0ad2c56a1b44bcf62c8558a3f

URL: https://github.com/llvm/llvm-project/commit/d3e10944730bd8b0ad2c56a1b44bcf62c8558a3f
DIFF: https://github.com/llvm/llvm-project/commit/d3e10944730bd8b0ad2c56a1b44bcf62c8558a3f.diff

LOG: [VPlan] Implement VPCanonicalIVPHIRecipe::onlyFirstLaneUsed.

The recipe only uses the first lane of its operands.

Suggested & split off D120827.

Added: 
    

Modified: 
    llvm/lib/Transforms/Vectorize/VPlan.h

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/VPlan.h b/llvm/lib/Transforms/Vectorize/VPlan.h
index a8a8f516db472..9346c7a6b00fd 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.h
+++ b/llvm/lib/Transforms/Vectorize/VPlan.h
@@ -1917,6 +1917,13 @@ class VPScalarIVStepsRecipe : public VPRecipeBase, public VPValue {
   VPCanonicalIVPHIRecipe *getCanonicalIV() const;
   VPValue *getStartValue() const { return getOperand(1); }
   VPValue *getStepValue() const { return getOperand(2); }
+
+  /// Returns true if the recipe only uses the first lane of operand \p Op.
+  bool onlyFirstLaneUsed(const VPValue *Op) const override {
+    assert(is_contained(operands(), Op) &&
+           "Op must be an operand of the recipe");
+    return true;
+  }
 };
 
 /// VPBasicBlock serves as the leaf of the Hierarchical Control-Flow Graph. It


        


More information about the llvm-commits mailing list