@@ -1786,7 +1786,8 @@ class IRBuilderBase {
17861786
17871787 Value *CreateGEP (Value *Ptr, ArrayRef<Value *> IdxList,
17881788 const Twine &Name = " " ) {
1789- return CreateGEP (nullptr , Ptr, IdxList, Name);
1789+ return CreateGEP (
1790+ Ptr->getType ()->getPointerElementType (), Ptr, IdxList, Name);
17901791 }
17911792
17921793 Value *CreateGEP (Type *Ty, Value *Ptr, ArrayRef<Value *> IdxList,
@@ -1805,7 +1806,8 @@ class IRBuilderBase {
18051806
18061807 Value *CreateInBoundsGEP (Value *Ptr, ArrayRef<Value *> IdxList,
18071808 const Twine &Name = " " ) {
1808- return CreateInBoundsGEP (nullptr , Ptr, IdxList, Name);
1809+ return CreateInBoundsGEP (
1810+ Ptr->getType ()->getPointerElementType (), Ptr, IdxList, Name);
18091811 }
18101812
18111813 Value *CreateInBoundsGEP (Type *Ty, Value *Ptr, ArrayRef<Value *> IdxList,
@@ -1824,7 +1826,7 @@ class IRBuilderBase {
18241826 }
18251827
18261828 Value *CreateGEP (Value *Ptr, Value *Idx, const Twine &Name = " " ) {
1827- return CreateGEP (nullptr , Ptr, Idx, Name);
1829+ return CreateGEP (Ptr-> getType ()-> getPointerElementType () , Ptr, Idx, Name);
18281830 }
18291831
18301832 Value *CreateGEP (Type *Ty, Value *Ptr, Value *Idx, const Twine &Name = " " ) {
@@ -1843,7 +1845,8 @@ class IRBuilderBase {
18431845 }
18441846
18451847 Value *CreateConstGEP1_32 (Value *Ptr, unsigned Idx0, const Twine &Name = " " ) {
1846- return CreateConstGEP1_32 (nullptr , Ptr, Idx0, Name);
1848+ return CreateConstGEP1_32 (
1849+ Ptr->getType ()->getPointerElementType (), Ptr, Idx0, Name);
18471850 }
18481851
18491852 Value *CreateConstGEP1_32 (Type *Ty, Value *Ptr, unsigned Idx0,
@@ -1903,7 +1906,8 @@ class IRBuilderBase {
19031906 }
19041907
19051908 Value *CreateConstGEP1_64 (Value *Ptr, uint64_t Idx0, const Twine &Name = " " ) {
1906- return CreateConstGEP1_64 (nullptr , Ptr, Idx0, Name);
1909+ return CreateConstGEP1_64 (
1910+ Ptr->getType ()->getPointerElementType (), Ptr, Idx0, Name);
19071911 }
19081912
19091913 Value *CreateConstInBoundsGEP1_64 (Type *Ty, Value *Ptr, uint64_t Idx0,
@@ -1918,7 +1922,8 @@ class IRBuilderBase {
19181922
19191923 Value *CreateConstInBoundsGEP1_64 (Value *Ptr, uint64_t Idx0,
19201924 const Twine &Name = " " ) {
1921- return CreateConstInBoundsGEP1_64 (nullptr , Ptr, Idx0, Name);
1925+ return CreateConstInBoundsGEP1_64 (
1926+ Ptr->getType ()->getPointerElementType (), Ptr, Idx0, Name);
19221927 }
19231928
19241929 Value *CreateConstGEP2_64 (Type *Ty, Value *Ptr, uint64_t Idx0, uint64_t Idx1,
@@ -1936,7 +1941,8 @@ class IRBuilderBase {
19361941
19371942 Value *CreateConstGEP2_64 (Value *Ptr, uint64_t Idx0, uint64_t Idx1,
19381943 const Twine &Name = " " ) {
1939- return CreateConstGEP2_64 (nullptr , Ptr, Idx0, Idx1, Name);
1944+ return CreateConstGEP2_64 (
1945+ Ptr->getType ()->getPointerElementType (), Ptr, Idx0, Idx1, Name);
19401946 }
19411947
19421948 Value *CreateConstInBoundsGEP2_64 (Type *Ty, Value *Ptr, uint64_t Idx0,
@@ -1954,7 +1960,8 @@ class IRBuilderBase {
19541960
19551961 Value *CreateConstInBoundsGEP2_64 (Value *Ptr, uint64_t Idx0, uint64_t Idx1,
19561962 const Twine &Name = " " ) {
1957- return CreateConstInBoundsGEP2_64 (nullptr , Ptr, Idx0, Idx1, Name);
1963+ return CreateConstInBoundsGEP2_64 (
1964+ Ptr->getType ()->getPointerElementType (), Ptr, Idx0, Idx1, Name);
19581965 }
19591966
19601967 Value *CreateStructGEP (Type *Ty, Value *Ptr, unsigned Idx,
@@ -1963,7 +1970,8 @@ class IRBuilderBase {
19631970 }
19641971
19651972 Value *CreateStructGEP (Value *Ptr, unsigned Idx, const Twine &Name = " " ) {
1966- return CreateConstInBoundsGEP2_32 (nullptr , Ptr, 0 , Idx, Name);
1973+ return CreateConstInBoundsGEP2_32 (
1974+ Ptr->getType ()->getPointerElementType (), Ptr, 0 , Idx, Name);
19671975 }
19681976
19691977 // / Same as CreateGlobalString, but return a pointer with "i8*" type
0 commit comments