diff options
Diffstat (limited to 'llvm/lib/CodeGen/CodeGenPrepare.cpp')
-rw-r--r-- | llvm/lib/CodeGen/CodeGenPrepare.cpp | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp index e06b430..6e99fb1 100644 --- a/llvm/lib/CodeGen/CodeGenPrepare.cpp +++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp @@ -6188,8 +6188,6 @@ bool CodeGenPrepare::splitLargeGEPOffsets() { // Generate a new GEP to replace the current one. LLVMContext &Ctx = GEP->getContext(); Type *PtrIdxTy = DL->getIndexType(GEP->getType()); - Type *I8PtrTy = - PointerType::get(Ctx, GEP->getType()->getPointerAddressSpace()); Type *I8Ty = Type::getInt8Ty(Ctx); if (!NewBaseGEP) { @@ -6200,16 +6198,10 @@ bool CodeGenPrepare::splitLargeGEPOffsets() { IRBuilder<> Builder(GEP); Value *NewGEP = NewBaseGEP; - if (Offset == BaseOffset) { - if (GEP->getType() != I8PtrTy) - NewGEP = Builder.CreatePointerCast(NewGEP, GEP->getType()); - } else { + if (Offset != BaseOffset) { // Calculate the new offset for the new GEP. Value *Index = ConstantInt::get(PtrIdxTy, Offset - BaseOffset); NewGEP = Builder.CreateGEP(I8Ty, NewBaseGEP, Index); - - if (GEP->getType() != I8PtrTy) - NewGEP = Builder.CreatePointerCast(NewGEP, GEP->getType()); } replaceAllUsesWith(GEP, NewGEP, FreshBBs, IsHugeFunc); LargeOffsetGEPID.erase(GEP); |