forked from OSchip/llvm-project
[IR] Restore vector support for deprecated CreateGEP methods
As pointed out in post-commit review on rG8e22539067d9, it's necessary to call getScalarType() to support GEPs with a vector base. Dropping that call was an oversight on my side.
This commit is contained in:
parent
a276f45180
commit
83a87b831a
|
@ -1786,8 +1786,8 @@ public:
|
||||||
|
|
||||||
Value *CreateGEP(Value *Ptr, ArrayRef<Value *> IdxList,
|
Value *CreateGEP(Value *Ptr, ArrayRef<Value *> IdxList,
|
||||||
const Twine &Name = "") {
|
const Twine &Name = "") {
|
||||||
return CreateGEP(
|
return CreateGEP(Ptr->getType()->getScalarType()->getPointerElementType(),
|
||||||
Ptr->getType()->getPointerElementType(), Ptr, IdxList, Name);
|
Ptr, IdxList, Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
Value *CreateGEP(Type *Ty, Value *Ptr, ArrayRef<Value *> IdxList,
|
Value *CreateGEP(Type *Ty, Value *Ptr, ArrayRef<Value *> IdxList,
|
||||||
|
@ -1807,7 +1807,8 @@ public:
|
||||||
Value *CreateInBoundsGEP(Value *Ptr, ArrayRef<Value *> IdxList,
|
Value *CreateInBoundsGEP(Value *Ptr, ArrayRef<Value *> IdxList,
|
||||||
const Twine &Name = "") {
|
const Twine &Name = "") {
|
||||||
return CreateInBoundsGEP(
|
return CreateInBoundsGEP(
|
||||||
Ptr->getType()->getPointerElementType(), Ptr, IdxList, Name);
|
Ptr->getType()->getScalarType()->getPointerElementType(), Ptr, IdxList,
|
||||||
|
Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
Value *CreateInBoundsGEP(Type *Ty, Value *Ptr, ArrayRef<Value *> IdxList,
|
Value *CreateInBoundsGEP(Type *Ty, Value *Ptr, ArrayRef<Value *> IdxList,
|
||||||
|
@ -1826,7 +1827,8 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
Value *CreateGEP(Value *Ptr, Value *Idx, const Twine &Name = "") {
|
Value *CreateGEP(Value *Ptr, Value *Idx, const Twine &Name = "") {
|
||||||
return CreateGEP(Ptr->getType()->getPointerElementType(), Ptr, Idx, Name);
|
return CreateGEP(Ptr->getType()->getScalarType()->getPointerElementType(),
|
||||||
|
Ptr, Idx, Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
Value *CreateGEP(Type *Ty, Value *Ptr, Value *Idx, const Twine &Name = "") {
|
Value *CreateGEP(Type *Ty, Value *Ptr, Value *Idx, const Twine &Name = "") {
|
||||||
|
@ -1846,7 +1848,8 @@ public:
|
||||||
|
|
||||||
Value *CreateConstGEP1_32(Value *Ptr, unsigned Idx0, const Twine &Name = "") {
|
Value *CreateConstGEP1_32(Value *Ptr, unsigned Idx0, const Twine &Name = "") {
|
||||||
return CreateConstGEP1_32(
|
return CreateConstGEP1_32(
|
||||||
Ptr->getType()->getPointerElementType(), Ptr, Idx0, Name);
|
Ptr->getType()->getScalarType()->getPointerElementType(), Ptr, Idx0,
|
||||||
|
Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
Value *CreateConstGEP1_32(Type *Ty, Value *Ptr, unsigned Idx0,
|
Value *CreateConstGEP1_32(Type *Ty, Value *Ptr, unsigned Idx0,
|
||||||
|
@ -1907,7 +1910,8 @@ public:
|
||||||
|
|
||||||
Value *CreateConstGEP1_64(Value *Ptr, uint64_t Idx0, const Twine &Name = "") {
|
Value *CreateConstGEP1_64(Value *Ptr, uint64_t Idx0, const Twine &Name = "") {
|
||||||
return CreateConstGEP1_64(
|
return CreateConstGEP1_64(
|
||||||
Ptr->getType()->getPointerElementType(), Ptr, Idx0, Name);
|
Ptr->getType()->getScalarType()->getPointerElementType(), Ptr, Idx0,
|
||||||
|
Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
Value *CreateConstInBoundsGEP1_64(Type *Ty, Value *Ptr, uint64_t Idx0,
|
Value *CreateConstInBoundsGEP1_64(Type *Ty, Value *Ptr, uint64_t Idx0,
|
||||||
|
@ -1923,7 +1927,8 @@ public:
|
||||||
Value *CreateConstInBoundsGEP1_64(Value *Ptr, uint64_t Idx0,
|
Value *CreateConstInBoundsGEP1_64(Value *Ptr, uint64_t Idx0,
|
||||||
const Twine &Name = "") {
|
const Twine &Name = "") {
|
||||||
return CreateConstInBoundsGEP1_64(
|
return CreateConstInBoundsGEP1_64(
|
||||||
Ptr->getType()->getPointerElementType(), Ptr, Idx0, Name);
|
Ptr->getType()->getScalarType()->getPointerElementType(), Ptr, Idx0,
|
||||||
|
Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
Value *CreateConstGEP2_64(Type *Ty, Value *Ptr, uint64_t Idx0, uint64_t Idx1,
|
Value *CreateConstGEP2_64(Type *Ty, Value *Ptr, uint64_t Idx0, uint64_t Idx1,
|
||||||
|
@ -1942,7 +1947,8 @@ public:
|
||||||
Value *CreateConstGEP2_64(Value *Ptr, uint64_t Idx0, uint64_t Idx1,
|
Value *CreateConstGEP2_64(Value *Ptr, uint64_t Idx0, uint64_t Idx1,
|
||||||
const Twine &Name = "") {
|
const Twine &Name = "") {
|
||||||
return CreateConstGEP2_64(
|
return CreateConstGEP2_64(
|
||||||
Ptr->getType()->getPointerElementType(), Ptr, Idx0, Idx1, Name);
|
Ptr->getType()->getScalarType()->getPointerElementType(), Ptr, Idx0,
|
||||||
|
Idx1, Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
Value *CreateConstInBoundsGEP2_64(Type *Ty, Value *Ptr, uint64_t Idx0,
|
Value *CreateConstInBoundsGEP2_64(Type *Ty, Value *Ptr, uint64_t Idx0,
|
||||||
|
@ -1961,7 +1967,8 @@ public:
|
||||||
Value *CreateConstInBoundsGEP2_64(Value *Ptr, uint64_t Idx0, uint64_t Idx1,
|
Value *CreateConstInBoundsGEP2_64(Value *Ptr, uint64_t Idx0, uint64_t Idx1,
|
||||||
const Twine &Name = "") {
|
const Twine &Name = "") {
|
||||||
return CreateConstInBoundsGEP2_64(
|
return CreateConstInBoundsGEP2_64(
|
||||||
Ptr->getType()->getPointerElementType(), Ptr, Idx0, Idx1, Name);
|
Ptr->getType()->getScalarType()->getPointerElementType(), Ptr, Idx0,
|
||||||
|
Idx1, Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
Value *CreateStructGEP(Type *Ty, Value *Ptr, unsigned Idx,
|
Value *CreateStructGEP(Type *Ty, Value *Ptr, unsigned Idx,
|
||||||
|
@ -1971,7 +1978,8 @@ public:
|
||||||
|
|
||||||
Value *CreateStructGEP(Value *Ptr, unsigned Idx, const Twine &Name = "") {
|
Value *CreateStructGEP(Value *Ptr, unsigned Idx, const Twine &Name = "") {
|
||||||
return CreateConstInBoundsGEP2_32(
|
return CreateConstInBoundsGEP2_32(
|
||||||
Ptr->getType()->getPointerElementType(), Ptr, 0, Idx, Name);
|
Ptr->getType()->getScalarType()->getPointerElementType(), Ptr, 0, Idx,
|
||||||
|
Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Same as CreateGlobalString, but return a pointer with "i8*" type
|
/// Same as CreateGlobalString, but return a pointer with "i8*" type
|
||||||
|
|
|
@ -987,8 +987,9 @@ public:
|
||||||
Value *Ptr, ArrayRef<Value *> IdxList, const Twine &NameStr = "",
|
Value *Ptr, ArrayRef<Value *> IdxList, const Twine &NameStr = "",
|
||||||
Instruction *InsertBefore = nullptr),
|
Instruction *InsertBefore = nullptr),
|
||||||
"Use the version with explicit element type instead") {
|
"Use the version with explicit element type instead") {
|
||||||
return CreateInBounds(Ptr->getType()->getPointerElementType(), Ptr, IdxList,
|
return CreateInBounds(
|
||||||
NameStr, InsertBefore);
|
Ptr->getType()->getScalarType()->getPointerElementType(), Ptr, IdxList,
|
||||||
|
NameStr, InsertBefore);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create an "inbounds" getelementptr. See the documentation for the
|
/// Create an "inbounds" getelementptr. See the documentation for the
|
||||||
|
@ -1007,8 +1008,9 @@ public:
|
||||||
Value *Ptr, ArrayRef<Value *> IdxList, const Twine &NameStr,
|
Value *Ptr, ArrayRef<Value *> IdxList, const Twine &NameStr,
|
||||||
BasicBlock *InsertAtEnd),
|
BasicBlock *InsertAtEnd),
|
||||||
"Use the version with explicit element type instead") {
|
"Use the version with explicit element type instead") {
|
||||||
return CreateInBounds(Ptr->getType()->getPointerElementType(), Ptr, IdxList,
|
return CreateInBounds(
|
||||||
NameStr, InsertAtEnd);
|
Ptr->getType()->getScalarType()->getPointerElementType(), Ptr, IdxList,
|
||||||
|
NameStr, InsertAtEnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GetElementPtrInst *CreateInBounds(Type *PointeeType, Value *Ptr,
|
static GetElementPtrInst *CreateInBounds(Type *PointeeType, Value *Ptr,
|
||||||
|
|
Loading…
Reference in New Issue