Skip to content

Commit

Permalink
[IRBuilder] Add CreatePtrAdd() method (NFC) (#77582)
Browse files Browse the repository at this point in the history
This abstracts over the common pattern of creating a gep with i8 element
type.
  • Loading branch information
nikic authored Jan 12, 2024
1 parent ae5d639 commit 6c2fbc3
Show file tree
Hide file tree
Showing 22 changed files with 77 additions and 90 deletions.
10 changes: 10 additions & 0 deletions llvm/include/llvm/IR/IRBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -1974,6 +1974,16 @@ class IRBuilderBase {
return CreateConstInBoundsGEP2_32(Ty, Ptr, 0, Idx, Name);
}

Value *CreatePtrAdd(Value *Ptr, Value *Offset, const Twine &Name = "",
bool IsInBounds = false) {
return CreateGEP(getInt8Ty(), Ptr, Offset, Name, IsInBounds);
}

Value *CreateInBoundsPtrAdd(Value *Ptr, Value *Offset,
const Twine &Name = "") {
return CreateGEP(getInt8Ty(), Ptr, Offset, Name, /*IsInBounds*/ true);
}

/// Same as CreateGlobalString, but return a pointer with "i8*" type
/// instead of a pointer to array of i8.
///
Expand Down
16 changes: 6 additions & 10 deletions llvm/lib/CodeGen/CodeGenPrepare.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5553,7 +5553,6 @@ bool CodeGenPrepare::optimizeMemoryInst(Instruction *MemoryInst, Value *Addr,
} else {
Type *I8PtrTy =
Builder.getPtrTy(Addr->getType()->getPointerAddressSpace());
Type *I8Ty = Builder.getInt8Ty();

// Start with the base register. Do this first so that subsequent address
// matching finds it last, which will prevent it from trying to match it
Expand Down Expand Up @@ -5597,8 +5596,8 @@ bool CodeGenPrepare::optimizeMemoryInst(Instruction *MemoryInst, Value *Addr,
// SDAG consecutive load/store merging.
if (ResultPtr->getType() != I8PtrTy)
ResultPtr = Builder.CreatePointerCast(ResultPtr, I8PtrTy);
ResultPtr = Builder.CreateGEP(I8Ty, ResultPtr, ResultIndex,
"sunkaddr", AddrMode.InBounds);
ResultPtr = Builder.CreatePtrAdd(ResultPtr, ResultIndex, "sunkaddr",
AddrMode.InBounds);
}

ResultIndex = V;
Expand All @@ -5609,8 +5608,8 @@ bool CodeGenPrepare::optimizeMemoryInst(Instruction *MemoryInst, Value *Addr,
} else {
if (ResultPtr->getType() != I8PtrTy)
ResultPtr = Builder.CreatePointerCast(ResultPtr, I8PtrTy);
SunkAddr = Builder.CreateGEP(I8Ty, ResultPtr, ResultIndex, "sunkaddr",
AddrMode.InBounds);
SunkAddr = Builder.CreatePtrAdd(ResultPtr, ResultIndex, "sunkaddr",
AddrMode.InBounds);
}

if (SunkAddr->getType() != Addr->getType()) {
Expand Down Expand Up @@ -6169,7 +6168,6 @@ bool CodeGenPrepare::splitLargeGEPOffsets() {
Type *PtrIdxTy = DL->getIndexType(GEP->getType());
Type *I8PtrTy =
PointerType::get(Ctx, GEP->getType()->getPointerAddressSpace());
Type *I8Ty = Type::getInt8Ty(Ctx);

BasicBlock::iterator NewBaseInsertPt;
BasicBlock *NewBaseInsertBB;
Expand Down Expand Up @@ -6198,7 +6196,7 @@ bool CodeGenPrepare::splitLargeGEPOffsets() {
if (NewBaseGEP->getType() != I8PtrTy)
NewBaseGEP = NewBaseBuilder.CreatePointerCast(NewBaseGEP, I8PtrTy);
NewBaseGEP =
NewBaseBuilder.CreateGEP(I8Ty, NewBaseGEP, BaseIndex, "splitgep");
NewBaseBuilder.CreatePtrAdd(NewBaseGEP, BaseIndex, "splitgep");
NewGEPBases.insert(NewBaseGEP);
return;
};
Expand Down Expand Up @@ -6235,9 +6233,7 @@ bool CodeGenPrepare::splitLargeGEPOffsets() {
}

// Generate a new GEP to replace the current one.
LLVMContext &Ctx = GEP->getContext();
Type *PtrIdxTy = DL->getIndexType(GEP->getType());
Type *I8Ty = Type::getInt8Ty(Ctx);

if (!NewBaseGEP) {
// Create a new base if we don't have one yet. Find the insertion
Expand All @@ -6250,7 +6246,7 @@ bool CodeGenPrepare::splitLargeGEPOffsets() {
if (Offset != BaseOffset) {
// Calculate the new offset for the new GEP.
Value *Index = ConstantInt::get(PtrIdxTy, Offset - BaseOffset);
NewGEP = Builder.CreateGEP(I8Ty, NewBaseGEP, Index);
NewGEP = Builder.CreatePtrAdd(NewBaseGEP, Index);
}
replaceAllUsesWith(GEP, NewGEP, FreshBBs, IsHugeFunc);
LargeOffsetGEPID.erase(GEP);
Expand Down
5 changes: 2 additions & 3 deletions llvm/lib/CodeGen/PreISelIntrinsicLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ static bool lowerLoadRelative(Function &F) {

bool Changed = false;
Type *Int32Ty = Type::getInt32Ty(F.getContext());
Type *Int8Ty = Type::getInt8Ty(F.getContext());

for (Use &U : llvm::make_early_inc_range(F.uses())) {
auto CI = dyn_cast<CallInst>(U.getUser());
Expand All @@ -81,10 +80,10 @@ static bool lowerLoadRelative(Function &F) {

IRBuilder<> B(CI);
Value *OffsetPtr =
B.CreateGEP(Int8Ty, CI->getArgOperand(0), CI->getArgOperand(1));
B.CreatePtrAdd(CI->getArgOperand(0), CI->getArgOperand(1));
Value *OffsetI32 = B.CreateAlignedLoad(Int32Ty, OffsetPtr, Align(4));

Value *ResultPtr = B.CreateGEP(Int8Ty, CI->getArgOperand(0), OffsetI32);
Value *ResultPtr = B.CreatePtrAdd(CI->getArgOperand(0), OffsetI32);

CI->replaceAllUsesWith(ResultPtr);
CI->eraseFromParent();
Expand Down
22 changes: 10 additions & 12 deletions llvm/lib/CodeGen/SafeStack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ class SafeStack {
Type *StackPtrTy;
Type *IntPtrTy;
Type *Int32Ty;
Type *Int8Ty;

Value *UnsafeStackPtr = nullptr;

Expand Down Expand Up @@ -195,8 +194,7 @@ class SafeStack {
: F(F), TL(TL), DL(DL), DTU(DTU), SE(SE),
StackPtrTy(PointerType::getUnqual(F.getContext())),
IntPtrTy(DL.getIntPtrType(F.getContext())),
Int32Ty(Type::getInt32Ty(F.getContext())),
Int8Ty(Type::getInt8Ty(F.getContext())) {}
Int32Ty(Type::getInt32Ty(F.getContext())) {}

// Run the transformation on the associated function.
// Returns whether the function was changed.
Expand Down Expand Up @@ -562,8 +560,8 @@ Value *SafeStack::moveStaticAllocasToUnsafeStack(

if (StackGuardSlot) {
unsigned Offset = SSL.getObjectOffset(StackGuardSlot);
Value *Off = IRB.CreateGEP(Int8Ty, BasePointer, // BasePointer is i8*
ConstantInt::get(Int32Ty, -Offset));
Value *Off =
IRB.CreatePtrAdd(BasePointer, ConstantInt::get(Int32Ty, -Offset));
Value *NewAI =
IRB.CreateBitCast(Off, StackGuardSlot->getType(), "StackGuardSlot");

Expand All @@ -581,10 +579,10 @@ Value *SafeStack::moveStaticAllocasToUnsafeStack(
if (Size == 0)
Size = 1; // Don't create zero-sized stack objects.

Value *Off = IRB.CreateGEP(Int8Ty, BasePointer, // BasePointer is i8*
ConstantInt::get(Int32Ty, -Offset));
Value *Off =
IRB.CreatePtrAdd(BasePointer, ConstantInt::get(Int32Ty, -Offset));
Value *NewArg = IRB.CreateBitCast(Off, Arg->getType(),
Arg->getName() + ".unsafe-byval");
Arg->getName() + ".unsafe-byval");

// Replace alloc with the new location.
replaceDbgDeclare(Arg, BasePointer, DIB, DIExpression::ApplyOffset,
Expand Down Expand Up @@ -616,8 +614,8 @@ Value *SafeStack::moveStaticAllocasToUnsafeStack(
InsertBefore = User;

IRBuilder<> IRBUser(InsertBefore);
Value *Off = IRBUser.CreateGEP(Int8Ty, BasePointer, // BasePointer is i8*
ConstantInt::get(Int32Ty, -Offset));
Value *Off =
IRBUser.CreatePtrAdd(BasePointer, ConstantInt::get(Int32Ty, -Offset));
Value *Replacement = IRBUser.CreateBitCast(Off, AI->getType(), Name);

if (auto *PHI = dyn_cast<PHINode>(User))
Expand Down Expand Up @@ -647,8 +645,8 @@ Value *SafeStack::moveStaticAllocasToUnsafeStack(
IRB.SetInsertPoint(BasePointer->getNextNode());

Value *StaticTop =
IRB.CreateGEP(Int8Ty, BasePointer, ConstantInt::get(Int32Ty, -FrameSize),
"unsafe_stack_static_top");
IRB.CreatePtrAdd(BasePointer, ConstantInt::get(Int32Ty, -FrameSize),
"unsafe_stack_static_top");
IRB.CreateStore(StaticTop, UnsafeStackPtr);
return StaticTop;
}
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -687,8 +687,7 @@ auto AlignVectors::createAdjustedPointer(IRBuilderBase &Builder, Value *Ptr,
if (auto *I = dyn_cast<Instruction>(Ptr))
if (Instruction *New = CloneMap.lookup(I))
Ptr = New;
return Builder.CreateGEP(Type::getInt8Ty(HVC.F.getContext()), Ptr,
HVC.getConstInt(Adjust), "gep");
return Builder.CreatePtrAdd(Ptr, HVC.getConstInt(Adjust), "gep");
}

auto AlignVectors::createAlignedPointer(IRBuilderBase &Builder, Value *Ptr,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -808,8 +808,8 @@ static bool foldConsecutiveLoads(Instruction &I, const DataLayout &DL,
APInt Offset1(DL.getIndexTypeSizeInBits(Load1Ptr->getType()), 0);
Load1Ptr = Load1Ptr->stripAndAccumulateConstantOffsets(
DL, Offset1, /* AllowNonInbounds */ true);
Load1Ptr = Builder.CreateGEP(Builder.getInt8Ty(), Load1Ptr,
Builder.getInt32(Offset1.getZExtValue()));
Load1Ptr = Builder.CreatePtrAdd(Load1Ptr,
Builder.getInt32(Offset1.getZExtValue()));
}
// Generate wider load.
NewLoad = Builder.CreateAlignedLoad(WiderType, Load1Ptr, LI1->getAlign(),
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/Transforms/Coroutines/CoroFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2022,8 +2022,8 @@ static void insertSpills(const FrameDataInfo &FrameData, coro::Shape &Shape) {
auto *FramePtr = GetFramePointer(Alloca);
auto &Value = *Alias.second;
auto ITy = IntegerType::get(C, Value.getBitWidth());
auto *AliasPtr = Builder.CreateGEP(Type::getInt8Ty(C), FramePtr,
ConstantInt::get(ITy, Value));
auto *AliasPtr =
Builder.CreatePtrAdd(FramePtr, ConstantInt::get(ITy, Value));
Alias.first->replaceUsesWithIf(
AliasPtr, [&](Use &U) { return DT.dominates(CB, U); });
}
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ static Value *createByteGEP(IRBuilderBase &IRB, const DataLayout &DL,
Value *Ptr, Type *ResElemTy, int64_t Offset) {
if (Offset != 0) {
APInt APOffset(DL.getIndexTypeSizeInBits(Ptr->getType()), Offset);
Ptr = IRB.CreateGEP(IRB.getInt8Ty(), Ptr, IRB.getInt(APOffset));
Ptr = IRB.CreatePtrAdd(Ptr, IRB.getInt(APOffset));
}
return Ptr;
}
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/Transforms/IPO/AttributorAttributes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,8 @@ static Value *constructPointer(Value *Ptr, int64_t Offset,
<< "-bytes\n");

if (Offset)
Ptr = IRB.CreateGEP(IRB.getInt8Ty(), Ptr, IRB.getInt64(Offset),
Ptr->getName() + ".b" + Twine(Offset));
Ptr = IRB.CreatePtrAdd(Ptr, IRB.getInt64(Offset),
Ptr->getName() + ".b" + Twine(Offset));
return Ptr;
}

Expand Down
6 changes: 3 additions & 3 deletions llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1769,7 +1769,7 @@ void DevirtModule::applyVirtualConstProp(CallSiteInfo &CSInfo, StringRef FnName,
continue;
auto *RetType = cast<IntegerType>(Call.CB.getType());
IRBuilder<> B(&Call.CB);
Value *Addr = B.CreateGEP(Int8Ty, Call.VTable, Byte);
Value *Addr = B.CreatePtrAdd(Call.VTable, Byte);
if (RetType->getBitWidth() == 1) {
Value *Bits = B.CreateLoad(Int8Ty, Addr);
Value *BitsAndBit = B.CreateAnd(Bits, Bit);
Expand Down Expand Up @@ -2066,14 +2066,14 @@ void DevirtModule::scanTypeCheckedLoadUsers(Function *TypeCheckedLoadFunc) {
Value *LoadedValue = nullptr;
if (TypeCheckedLoadFunc->getIntrinsicID() ==
Intrinsic::type_checked_load_relative) {
Value *GEP = LoadB.CreateGEP(Int8Ty, Ptr, Offset);
Value *GEP = LoadB.CreatePtrAdd(Ptr, Offset);
LoadedValue = LoadB.CreateLoad(Int32Ty, GEP);
LoadedValue = LoadB.CreateSExt(LoadedValue, IntPtrTy);
GEP = LoadB.CreatePtrToInt(GEP, IntPtrTy);
LoadedValue = LoadB.CreateAdd(GEP, LoadedValue);
LoadedValue = LoadB.CreateIntToPtr(LoadedValue, Int8PtrTy);
} else {
Value *GEP = LoadB.CreateGEP(Int8Ty, Ptr, Offset);
Value *GEP = LoadB.CreatePtrAdd(Ptr, Offset);
LoadedValue = LoadB.CreateLoad(Int8PtrTy, GEP);
}

Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1590,8 +1590,7 @@ void AddressSanitizer::instrumentMaskedLoadOrStore(
InstrumentedAddress = IRB.CreateExtractElement(Addr, Index);
} else if (Stride) {
Index = IRB.CreateMul(Index, Stride);
Addr = IRB.CreateBitCast(Addr, PointerType::getUnqual(*C));
InstrumentedAddress = IRB.CreateGEP(Type::getInt8Ty(*C), Addr, {Index});
InstrumentedAddress = IRB.CreatePtrAdd(Addr, Index);
} else {
InstrumentedAddress = IRB.CreateGEP(VTy, Addr, {Zero, Index});
}
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,7 @@ Value *HWAddressSanitizer::memToShadow(Value *Mem, IRBuilder<> &IRB) {
if (Mapping.Offset == 0)
return IRB.CreateIntToPtr(Shadow, PtrTy);
// (Mem >> Scale) + Offset
return IRB.CreateGEP(Int8Ty, ShadowBase, Shadow);
return IRB.CreatePtrAdd(ShadowBase, Shadow);
}

int64_t HWAddressSanitizer::getAccessInfo(bool IsWrite,
Expand Down
15 changes: 7 additions & 8 deletions llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5253,8 +5253,8 @@ struct VarArgAArch64Helper : public VarArgHelperBase {
Align(8), /*isStore*/ true)
.first;

Value *GrSrcPtr = IRB.CreateInBoundsGEP(IRB.getInt8Ty(), VAArgTLSCopy,
GrRegSaveAreaShadowPtrOff);
Value *GrSrcPtr =
IRB.CreateInBoundsPtrAdd(VAArgTLSCopy, GrRegSaveAreaShadowPtrOff);
Value *GrCopySize = IRB.CreateSub(GrArgSize, GrRegSaveAreaShadowPtrOff);

IRB.CreateMemCpy(GrRegSaveAreaShadowPtr, Align(8), GrSrcPtr, Align(8),
Expand All @@ -5269,10 +5269,9 @@ struct VarArgAArch64Helper : public VarArgHelperBase {
Align(8), /*isStore*/ true)
.first;

Value *VrSrcPtr = IRB.CreateInBoundsGEP(
IRB.getInt8Ty(),
IRB.CreateInBoundsGEP(IRB.getInt8Ty(), VAArgTLSCopy,
IRB.getInt32(AArch64VrBegOffset)),
Value *VrSrcPtr = IRB.CreateInBoundsPtrAdd(
IRB.CreateInBoundsPtrAdd(VAArgTLSCopy,
IRB.getInt32(AArch64VrBegOffset)),
VrRegSaveAreaShadowPtrOff);
Value *VrCopySize = IRB.CreateSub(VrArgSize, VrRegSaveAreaShadowPtrOff);

Expand All @@ -5285,8 +5284,8 @@ struct VarArgAArch64Helper : public VarArgHelperBase {
Align(16), /*isStore*/ true)
.first;

Value *StackSrcPtr = IRB.CreateInBoundsGEP(
IRB.getInt8Ty(), VAArgTLSCopy, IRB.getInt32(AArch64VAEndOffset));
Value *StackSrcPtr = IRB.CreateInBoundsPtrAdd(
VAArgTLSCopy, IRB.getInt32(AArch64VAEndOffset));

IRB.CreateMemCpy(StackSaveAreaShadowPtr, Align(16), StackSrcPtr,
Align(16), VAArgOverflowSize);
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,8 @@ ModuleSanitizerCoverage::CreateSecStartEnd(Module &M, const char *Section,

// Account for the fact that on windows-msvc __start_* symbols actually
// point to a uint64_t before the start of the array.
auto GEP = IRB.CreateGEP(Int8Ty, SecStart,
ConstantInt::get(IntptrTy, sizeof(uint64_t)));
auto GEP =
IRB.CreatePtrAdd(SecStart, ConstantInt::get(IntptrTy, sizeof(uint64_t)));
return std::make_pair(GEP, SecEnd);
}

Expand Down
6 changes: 3 additions & 3 deletions llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1297,9 +1297,9 @@ bool MemCpyOptPass::processMemSetMemCpyDependence(MemCpyInst *MemCpy,
Value *SizeDiff = Builder.CreateSub(DestSize, SrcSize);
Value *MemsetLen = Builder.CreateSelect(
Ule, ConstantInt::getNullValue(DestSize->getType()), SizeDiff);
Instruction *NewMemSet = Builder.CreateMemSet(
Builder.CreateGEP(Builder.getInt8Ty(), Dest, SrcSize),
MemSet->getOperand(1), MemsetLen, Alignment);
Instruction *NewMemSet =
Builder.CreateMemSet(Builder.CreatePtrAdd(Dest, SrcSize),
MemSet->getOperand(1), MemsetLen, Alignment);

assert(isa<MemoryDef>(MSSAU->getMemorySSA()->getMemoryAccess(MemCpy)) &&
"MemCpy must be a MemoryDef");
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/Transforms/Scalar/SROA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1903,8 +1903,8 @@ static Value *getAdjustedPtr(IRBuilderTy &IRB, const DataLayout &DL, Value *Ptr,
APInt Offset, Type *PointerTy,
const Twine &NamePrefix) {
if (Offset != 0)
Ptr = IRB.CreateInBoundsGEP(IRB.getInt8Ty(), Ptr, IRB.getInt(Offset),
NamePrefix + "sroa_idx");
Ptr = IRB.CreateInBoundsPtrAdd(Ptr, IRB.getInt(Offset),
NamePrefix + "sroa_idx");
return IRB.CreatePointerBitCastOrAddrSpaceCast(Ptr, PointerTy,
NamePrefix + "sroa_cast");
}
Expand Down
11 changes: 4 additions & 7 deletions llvm/lib/Transforms/Scalar/SeparateConstOffsetFromGEP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -896,8 +896,7 @@ void SeparateConstOffsetFromGEP::lowerToSingleIndexGEPs(
}
}
// Create an ugly GEP with a single index for each index.
ResultPtr =
Builder.CreateGEP(Builder.getInt8Ty(), ResultPtr, Idx, "uglygep");
ResultPtr = Builder.CreatePtrAdd(ResultPtr, Idx, "uglygep");
if (FirstResult == nullptr)
FirstResult = ResultPtr;
}
Expand All @@ -906,8 +905,7 @@ void SeparateConstOffsetFromGEP::lowerToSingleIndexGEPs(
// Create a GEP with the constant offset index.
if (AccumulativeByteOffset != 0) {
Value *Offset = ConstantInt::get(PtrIndexTy, AccumulativeByteOffset);
ResultPtr =
Builder.CreateGEP(Builder.getInt8Ty(), ResultPtr, Offset, "uglygep");
ResultPtr = Builder.CreatePtrAdd(ResultPtr, Offset, "uglygep");
} else
isSwapCandidate = false;

Expand Down Expand Up @@ -1107,9 +1105,8 @@ bool SeparateConstOffsetFromGEP::splitGEP(GetElementPtrInst *GEP) {

Type *PtrIdxTy = DL->getIndexType(GEP->getType());
IRBuilder<> Builder(GEP);
NewGEP = cast<Instruction>(Builder.CreateGEP(
Builder.getInt8Ty(), NewGEP,
{ConstantInt::get(PtrIdxTy, AccumulativeByteOffset, true)},
NewGEP = cast<Instruction>(Builder.CreatePtrAdd(
NewGEP, ConstantInt::get(PtrIdxTy, AccumulativeByteOffset, true),
GEP->getName(), GEPWasInBounds));
NewGEP->copyMetadata(*GEP);

Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -656,8 +656,7 @@ void StraightLineStrengthReduce::rewriteCandidateWithBasis(
case Candidate::GEP: {
bool InBounds = cast<GetElementPtrInst>(C.Ins)->isInBounds();
// C = (char *)Basis + Bump
Reduced =
Builder.CreateGEP(Builder.getInt8Ty(), Basis.Ins, Bump, "", InBounds);
Reduced = Builder.CreatePtrAdd(Basis.Ins, Bump, "", InBounds);
break;
}
default:
Expand Down
Loading

0 comments on commit 6c2fbc3

Please sign in to comment.