Skip to content

Commit 649347e

Browse files
[Vectorize] Remove unnecessary casts (NFC) (#148116)
&Ingredient is already of Instruction *.
1 parent 5c08bfa commit 649347e

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3055,8 +3055,7 @@ void VPPredInstPHIRecipe::print(raw_ostream &O, const Twine &Indent,
30553055
InstructionCost VPWidenMemoryRecipe::computeCost(ElementCount VF,
30563056
VPCostContext &Ctx) const {
30573057
Type *Ty = toVectorTy(getLoadStoreType(&Ingredient), VF);
3058-
const Align Alignment =
3059-
getLoadStoreAlignment(const_cast<Instruction *>(&Ingredient));
3058+
const Align Alignment = getLoadStoreAlignment(&Ingredient);
30603059
unsigned AS = cast<PointerType>(Ctx.Types.inferScalarType(getAddr()))
30613060
->getAddressSpace();
30623061
unsigned Opcode = isa<VPWidenLoadRecipe, VPWidenLoadEVLRecipe>(this)
@@ -3196,10 +3195,8 @@ InstructionCost VPWidenLoadEVLRecipe::computeCost(ElementCount VF,
31963195
// TODO: Using getMemoryOpCost() instead of getMaskedMemoryOpCost when we
31973196
// don't need to compare to the legacy cost model.
31983197
Type *Ty = toVectorTy(getLoadStoreType(&Ingredient), VF);
3199-
const Align Alignment =
3200-
getLoadStoreAlignment(const_cast<Instruction *>(&Ingredient));
3201-
unsigned AS =
3202-
getLoadStoreAddressSpace(const_cast<Instruction *>(&Ingredient));
3198+
const Align Alignment = getLoadStoreAlignment(&Ingredient);
3199+
unsigned AS = getLoadStoreAddressSpace(&Ingredient);
32033200
InstructionCost Cost = Ctx.TTI.getMaskedMemoryOpCost(
32043201
Instruction::Load, Ty, Alignment, AS, Ctx.CostKind);
32053202
if (!Reverse)
@@ -3309,10 +3306,8 @@ InstructionCost VPWidenStoreEVLRecipe::computeCost(ElementCount VF,
33093306
// TODO: Using getMemoryOpCost() instead of getMaskedMemoryOpCost when we
33103307
// don't need to compare to the legacy cost model.
33113308
Type *Ty = toVectorTy(getLoadStoreType(&Ingredient), VF);
3312-
const Align Alignment =
3313-
getLoadStoreAlignment(const_cast<Instruction *>(&Ingredient));
3314-
unsigned AS =
3315-
getLoadStoreAddressSpace(const_cast<Instruction *>(&Ingredient));
3309+
const Align Alignment = getLoadStoreAlignment(&Ingredient);
3310+
unsigned AS = getLoadStoreAddressSpace(&Ingredient);
33163311
InstructionCost Cost = Ctx.TTI.getMaskedMemoryOpCost(
33173312
Instruction::Store, Ty, Alignment, AS, Ctx.CostKind);
33183313
if (!Reverse)

0 commit comments

Comments
 (0)