@@ -1763,6 +1763,8 @@ struct LLVM_ABI_FOR_TEST VPWidenSelectRecipe : public VPRecipeWithIRFlags,
17631763
17641764// / A recipe for handling GEP instructions.
17651765class LLVM_ABI_FOR_TEST VPWidenGEPRecipe : public VPRecipeWithIRFlags {
1766+ Type *SourceElementTy;
1767+
17661768 bool isPointerLoopInvariant () const {
17671769 return getOperand (0 )->isDefinedOutsideLoopRegions ();
17681770 }
@@ -1779,7 +1781,8 @@ class LLVM_ABI_FOR_TEST VPWidenGEPRecipe : public VPRecipeWithIRFlags {
17791781
17801782public:
17811783 VPWidenGEPRecipe (GetElementPtrInst *GEP, ArrayRef<VPValue *> Operands)
1782- : VPRecipeWithIRFlags(VPDef::VPWidenGEPSC, Operands, *GEP) {
1784+ : VPRecipeWithIRFlags(VPDef::VPWidenGEPSC, Operands, *GEP),
1785+ SourceElementTy (GEP->getSourceElementType ()) {
17831786 SmallVector<std::pair<unsigned , MDNode *>> Metadata;
17841787 (void )Metadata;
17851788 getMetadataToPropagate (GEP, Metadata);
@@ -1801,6 +1804,8 @@ class LLVM_ABI_FOR_TEST VPWidenGEPRecipe : public VPRecipeWithIRFlags {
18011804 // / Generate the gep nodes.
18021805 void execute (VPTransformState &State) override ;
18031806
1807+ Type *getSourceElementType () const { return SourceElementTy; }
1808+
18041809 // / Return the cost of this VPWidenGEPRecipe.
18051810 InstructionCost computeCost (ElementCount VF,
18061811 VPCostContext &Ctx) const override {
@@ -1889,20 +1894,20 @@ class VPVectorEndPointerRecipe : public VPRecipeWithIRFlags,
18891894// / A recipe to compute the pointers for widened memory accesses of IndexTy.
18901895class VPVectorPointerRecipe : public VPRecipeWithIRFlags ,
18911896 public VPUnrollPartAccessor<1 > {
1892- Type *IndexedTy ;
1897+ Type *SourceElementTy ;
18931898
18941899public:
1895- VPVectorPointerRecipe (VPValue *Ptr, Type *IndexedTy, GEPNoWrapFlags GEPFlags ,
1896- DebugLoc DL)
1900+ VPVectorPointerRecipe (VPValue *Ptr, Type *SourceElementTy ,
1901+ GEPNoWrapFlags GEPFlags, DebugLoc DL)
18971902 : VPRecipeWithIRFlags(VPDef::VPVectorPointerSC, ArrayRef<VPValue *>(Ptr),
18981903 GEPFlags, DL),
1899- IndexedTy (IndexedTy ) {}
1904+ SourceElementTy (SourceElementTy ) {}
19001905
19011906 VP_CLASSOF_IMPL (VPDef::VPVectorPointerSC)
19021907
19031908 void execute(VPTransformState &State) override ;
19041909
1905- Type *getSourceElementType () const { return IndexedTy ; }
1910+ Type *getSourceElementType () const { return SourceElementTy ; }
19061911
19071912 bool onlyFirstLaneUsed (const VPValue *Op) const override {
19081913 assert (is_contained (operands (), Op) &&
@@ -1919,7 +1924,7 @@ class VPVectorPointerRecipe : public VPRecipeWithIRFlags,
19191924 }
19201925
19211926 VPVectorPointerRecipe *clone () override {
1922- return new VPVectorPointerRecipe (getOperand (0 ), IndexedTy ,
1927+ return new VPVectorPointerRecipe (getOperand (0 ), SourceElementTy ,
19231928 getGEPNoWrapFlags (), getDebugLoc ());
19241929 }
19251930
0 commit comments