@@ -1763,6 +1763,8 @@ struct LLVM_ABI_FOR_TEST VPWidenSelectRecipe : public VPRecipeWithIRFlags,
1763
1763
1764
1764
// / A recipe for handling GEP instructions.
1765
1765
class LLVM_ABI_FOR_TEST VPWidenGEPRecipe : public VPRecipeWithIRFlags {
1766
+ Type *SourceElementTy;
1767
+
1766
1768
bool isPointerLoopInvariant () const {
1767
1769
return getOperand (0 )->isDefinedOutsideLoopRegions ();
1768
1770
}
@@ -1779,7 +1781,8 @@ class LLVM_ABI_FOR_TEST VPWidenGEPRecipe : public VPRecipeWithIRFlags {
1779
1781
1780
1782
public:
1781
1783
VPWidenGEPRecipe (GetElementPtrInst *GEP, ArrayRef<VPValue *> Operands)
1782
- : VPRecipeWithIRFlags(VPDef::VPWidenGEPSC, Operands, *GEP) {
1784
+ : VPRecipeWithIRFlags(VPDef::VPWidenGEPSC, Operands, *GEP),
1785
+ SourceElementTy (GEP->getSourceElementType ()) {
1783
1786
SmallVector<std::pair<unsigned , MDNode *>> Metadata;
1784
1787
(void )Metadata;
1785
1788
getMetadataToPropagate (GEP, Metadata);
@@ -1801,6 +1804,8 @@ class LLVM_ABI_FOR_TEST VPWidenGEPRecipe : public VPRecipeWithIRFlags {
1801
1804
// / Generate the gep nodes.
1802
1805
void execute (VPTransformState &State) override ;
1803
1806
1807
+ Type *getSourceElementType () const { return SourceElementTy; }
1808
+
1804
1809
// / Return the cost of this VPWidenGEPRecipe.
1805
1810
InstructionCost computeCost (ElementCount VF,
1806
1811
VPCostContext &Ctx) const override {
@@ -1889,20 +1894,20 @@ class VPVectorEndPointerRecipe : public VPRecipeWithIRFlags,
1889
1894
// / A recipe to compute the pointers for widened memory accesses of IndexTy.
1890
1895
class VPVectorPointerRecipe : public VPRecipeWithIRFlags ,
1891
1896
public VPUnrollPartAccessor<1 > {
1892
- Type *IndexedTy ;
1897
+ Type *SourceElementTy ;
1893
1898
1894
1899
public:
1895
- VPVectorPointerRecipe (VPValue *Ptr, Type *IndexedTy, GEPNoWrapFlags GEPFlags ,
1896
- DebugLoc DL)
1900
+ VPVectorPointerRecipe (VPValue *Ptr, Type *SourceElementTy ,
1901
+ GEPNoWrapFlags GEPFlags, DebugLoc DL)
1897
1902
: VPRecipeWithIRFlags(VPDef::VPVectorPointerSC, ArrayRef<VPValue *>(Ptr),
1898
1903
GEPFlags, DL),
1899
- IndexedTy (IndexedTy ) {}
1904
+ SourceElementTy (SourceElementTy ) {}
1900
1905
1901
1906
VP_CLASSOF_IMPL (VPDef::VPVectorPointerSC)
1902
1907
1903
1908
void execute(VPTransformState &State) override ;
1904
1909
1905
- Type *getSourceElementType () const { return IndexedTy ; }
1910
+ Type *getSourceElementType () const { return SourceElementTy ; }
1906
1911
1907
1912
bool onlyFirstLaneUsed (const VPValue *Op) const override {
1908
1913
assert (is_contained (operands (), Op) &&
@@ -1919,7 +1924,7 @@ class VPVectorPointerRecipe : public VPRecipeWithIRFlags,
1919
1924
}
1920
1925
1921
1926
VPVectorPointerRecipe *clone () override {
1922
- return new VPVectorPointerRecipe (getOperand (0 ), IndexedTy ,
1927
+ return new VPVectorPointerRecipe (getOperand (0 ), SourceElementTy ,
1923
1928
getGEPNoWrapFlags (), getDebugLoc ());
1924
1929
}
1925
1930
0 commit comments