[llvm] 366ff3a - [VPlan] Get address space from inferred pointer type (NFC)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 20 02:38:49 PDT 2025


Author: Florian Hahn
Date: 2025-04-20T10:38:30+01:00
New Revision: 366ff3a89880139a132fe2738f36b39c89f5333e

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

LOG: [VPlan] Get address space from inferred pointer type (NFC)

Remove a use of the underlying ingredient by getting the address space
from the inferred pointer type.

Added: 
    

Modified: 
    llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
index 2cc558f49ccce..ff1ad29e75e2d 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
@@ -2684,8 +2684,8 @@ InstructionCost VPWidenMemoryRecipe::computeCost(ElementCount VF,
   Type *Ty = toVectorTy(getLoadStoreType(&Ingredient), VF);
   const Align Alignment =
       getLoadStoreAlignment(const_cast<Instruction *>(&Ingredient));
-  unsigned AS =
-      getLoadStoreAddressSpace(const_cast<Instruction *>(&Ingredient));
+  unsigned AS = cast<PointerType>(Ctx.Types.inferScalarType(getAddr()))
+                    ->getAddressSpace();
 
   if (!Consecutive) {
     // TODO: Using the original IR may not be accurate.


        


More information about the llvm-commits mailing list