Skip to content

Commit

Permalink
[NFC][OpaquePtr] Explicitly pass GEP source type to IRBuilder in more…
Browse files Browse the repository at this point in the history
… places
  • Loading branch information
aeubanks committed Jun 1, 2021
1 parent 2c19034 commit 2983053
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
6 changes: 4 additions & 2 deletions llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp
Expand Up @@ -443,13 +443,15 @@ auto AlignVectors::createAdjustedPointer(IRBuilder<> &Builder, Value *Ptr,
Type *ElemTy = cast<PointerType>(Ptr->getType())->getElementType();
int ElemSize = HVC.getSizeOf(ElemTy);
if (Adjust % ElemSize == 0) {
Value *Tmp0 = Builder.CreateGEP(Ptr, HVC.getConstInt(Adjust / ElemSize));
Value *Tmp0 =
Builder.CreateGEP(ElemTy, Ptr, HVC.getConstInt(Adjust / ElemSize));
return Builder.CreatePointerCast(Tmp0, ValTy->getPointerTo());
}

PointerType *CharPtrTy = Type::getInt8PtrTy(HVC.F.getContext());
Value *Tmp0 = Builder.CreatePointerCast(Ptr, CharPtrTy);
Value *Tmp1 = Builder.CreateGEP(Tmp0, HVC.getConstInt(Adjust));
Value *Tmp1 = Builder.CreateGEP(Type::getInt8Ty(HVC.F.getContext()), Tmp0,
HVC.getConstInt(Adjust));
return Builder.CreatePointerCast(Tmp1, ValTy->getPointerTo());
}

Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Transforms/Coroutines/CoroFrame.cpp
Expand Up @@ -1713,7 +1713,7 @@ static Instruction *insertSpills(const FrameDataInfo &FrameData,
auto *FramePtrRaw =
Builder.CreateBitCast(FramePtr, Type::getInt8PtrTy(C));
auto *AliasPtr = Builder.CreateGEP(
FramePtrRaw,
Type::getInt8Ty(C), FramePtrRaw,
ConstantInt::get(Type::getInt64Ty(C), Alias.second.getValue()));
auto *AliasPtrTyped =
Builder.CreateBitCast(AliasPtr, Alias.first->getType());
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Transforms/Utils/AMDGPUEmitPrintf.cpp
Expand Up @@ -134,7 +134,7 @@ static Value *getStrlenWithNull(IRBuilder<> &Builder, Value *Str) {

auto PtrPhi = Builder.CreatePHI(Str->getType(), 2);
PtrPhi->addIncoming(Str, Prev);
auto PtrNext = Builder.CreateGEP(PtrPhi, One);
auto PtrNext = Builder.CreateGEP(Builder.getInt8Ty(), PtrPhi, One);
PtrPhi->addIncoming(PtrNext, While);

// Condition for the while loop.
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
Expand Up @@ -1863,8 +1863,8 @@ Value *SCEVExpander::expandCodeForImpl(const SCEV *SH, Type *Ty, bool Root) {
cast<Instruction>(Builder.CreateAdd(Inst, Inst, "tmp.lcssa.user"));
else {
assert(Inst->getType()->isPointerTy());
Tmp = cast<Instruction>(
Builder.CreateGEP(Inst, Builder.getInt32(1), "tmp.lcssa.user"));
Tmp = cast<Instruction>(Builder.CreatePtrToInt(
Inst, Type::getInt32Ty(Inst->getContext()), "tmp.lcssa.user"));
}
V = fixupLCSSAFormFor(Tmp, 0);

Expand Down

0 comments on commit 2983053

Please sign in to comment.