summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/SROA.cpp
diff options
context:
space:
mode:
authorJames Y Knight <jyknight@google.com>2019-02-01 20:44:47 +0000
committerJames Y Knight <jyknight@google.com>2019-02-01 20:44:47 +0000
commit7716075a1729ead67844574fdb34579894122992 (patch)
tree1a3b91f53223202ab65c910dbc26979f5f05201c /llvm/lib/Transforms/Scalar/SROA.cpp
parent14359ef1b6a0610ac91df5f5a91c88a0b51c187c (diff)
downloadbcm5719-llvm-7716075a1729ead67844574fdb34579894122992.tar.gz
bcm5719-llvm-7716075a1729ead67844574fdb34579894122992.zip
[opaque pointer types] Pass value type to GetElementPtr creation.
This cleans up all GetElementPtr creation in LLVM to explicitly pass a value type rather than deriving it from the pointer's element-type. Differential Revision: https://reviews.llvm.org/D57173 llvm-svn: 352913
Diffstat (limited to 'llvm/lib/Transforms/Scalar/SROA.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/SROA.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Scalar/SROA.cpp b/llvm/lib/Transforms/Scalar/SROA.cpp
index 6be3f7903c9..7a63bf58b47 100644
--- a/llvm/lib/Transforms/Scalar/SROA.cpp
+++ b/llvm/lib/Transforms/Scalar/SROA.cpp
@@ -1371,8 +1371,8 @@ static Value *buildGEP(IRBuilderTy &IRB, Value *BasePtr,
if (Indices.size() == 1 && cast<ConstantInt>(Indices.back())->isZero())
return BasePtr;
- return IRB.CreateInBoundsGEP(nullptr, BasePtr, Indices,
- NamePrefix + "sroa_idx");
+ return IRB.CreateInBoundsGEP(BasePtr->getType()->getPointerElementType(),
+ BasePtr, Indices, NamePrefix + "sroa_idx");
}
/// Get a natural GEP off of the BasePtr walking through Ty toward
@@ -3298,7 +3298,7 @@ private:
assert(Ty->isSingleValueType());
// Load the single value and insert it using the indices.
Value *GEP =
- IRB.CreateInBoundsGEP(nullptr, Ptr, GEPIndices, Name + ".gep");
+ IRB.CreateInBoundsGEP(BaseTy, Ptr, GEPIndices, Name + ".gep");
LoadInst *Load = IRB.CreateAlignedLoad(Ty, GEP, Align, Name + ".load");
if (AATags)
Load->setAAMetadata(AATags);
@@ -3343,7 +3343,7 @@ private:
Value *ExtractValue =
IRB.CreateExtractValue(Agg, Indices, Name + ".extract");
Value *InBoundsGEP =
- IRB.CreateInBoundsGEP(nullptr, Ptr, GEPIndices, Name + ".gep");
+ IRB.CreateInBoundsGEP(BaseTy, Ptr, GEPIndices, Name + ".gep");
StoreInst *Store =
IRB.CreateAlignedStore(ExtractValue, InBoundsGEP, Align);
if (AATags)
OpenPOWER on IntegriCloud