[llvm] ef77188 - [VP] Remove createStepVector implementation and use IRBuilderBase::CreateStepVector instead. NFC (#122868)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 15 18:49:52 PST 2025


Author: LiqinWeng
Date: 2025-01-16T10:49:49+08:00
New Revision: ef77188fa85728b07059b5f42b92236998d25b19

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

LOG: [VP] Remove createStepVector implementation and use IRBuilderBase::CreateStepVector instead. NFC (#122868)

Added: 
    

Modified: 
    llvm/lib/CodeGen/ExpandVectorPredication.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/ExpandVectorPredication.cpp b/llvm/lib/CodeGen/ExpandVectorPredication.cpp
index 6f4a2c9ca7604f..67df1cd5246ef5 100644
--- a/llvm/lib/CodeGen/ExpandVectorPredication.cpp
+++ b/llvm/lib/CodeGen/ExpandVectorPredication.cpp
@@ -136,17 +136,6 @@ namespace {
 struct CachingVPExpander {
   const TargetTransformInfo &TTI;
 
-  /// \returns A (fixed length) vector with ascending integer indices
-  /// (<0, 1, ..., NumElems-1>).
-  /// \p Builder
-  ///    Used for instruction creation.
-  /// \p LaneTy
-  ///    Integer element type of the result vector.
-  /// \p NumElems
-  ///    Number of vector elements.
-  Value *createStepVector(IRBuilder<> &Builder, Type *LaneTy,
-                          unsigned NumElems);
-
   /// \returns A bitmask that is true where the lane position is less-than \p
   /// EVLParam
   ///
@@ -216,17 +205,6 @@ struct CachingVPExpander {
 
 //// CachingVPExpander {
 
-Value *CachingVPExpander::createStepVector(IRBuilder<> &Builder, Type *LaneTy,
-                                           unsigned NumElems) {
-  // TODO add caching
-  SmallVector<Constant *, 16> ConstElems;
-
-  for (unsigned Idx = 0; Idx < NumElems; ++Idx)
-    ConstElems.push_back(ConstantInt::get(LaneTy, Idx, false));
-
-  return ConstantVector::get(ConstElems);
-}
-
 Value *CachingVPExpander::convertEVLToMask(IRBuilder<> &Builder,
                                            Value *EVLParam,
                                            ElementCount ElemCount) {
@@ -245,7 +223,7 @@ Value *CachingVPExpander::convertEVLToMask(IRBuilder<> &Builder,
   Type *LaneTy = EVLParam->getType();
   unsigned NumElems = ElemCount.getFixedValue();
   Value *VLSplat = Builder.CreateVectorSplat(NumElems, EVLParam);
-  Value *IdxVec = createStepVector(Builder, LaneTy, NumElems);
+  Value *IdxVec = Builder.CreateStepVector(VectorType::get(LaneTy, ElemCount));
   return Builder.CreateICmp(CmpInst::ICMP_ULT, IdxVec, VLSplat);
 }
 


        


More information about the llvm-commits mailing list