[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.
diff --git a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
index 2cc558f..ff1ad29 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
@@ -2684,8 +2684,8 @@
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.