[llvm] 2983053 - [NFC][OpaquePtr] Explicitly pass GEP source type to IRBuilder in more places
Arthur Eubanks via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 1 13:13:43 PDT 2021
Author: Arthur Eubanks
Date: 2021-06-01T13:13:37-07:00
New Revision: 2983053d23d30b408122abf772bd50638f4ded2c
URL: https://github.com/llvm/llvm-project/commit/2983053d23d30b408122abf772bd50638f4ded2c
DIFF: https://github.com/llvm/llvm-project/commit/2983053d23d30b408122abf772bd50638f4ded2c.diff
LOG: [NFC][OpaquePtr] Explicitly pass GEP source type to IRBuilder in more places
Added:
Modified:
llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp
llvm/lib/Transforms/Coroutines/CoroFrame.cpp
llvm/lib/Transforms/Utils/AMDGPUEmitPrintf.cpp
llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp b/llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp
index 942d372095638..eea21d7d5baf0 100644
--- a/llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp
@@ -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());
}
diff --git a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp
index 9419c346a97b1..18f8e5e61a401 100644
--- a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp
+++ b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp
@@ -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());
diff --git a/llvm/lib/Transforms/Utils/AMDGPUEmitPrintf.cpp b/llvm/lib/Transforms/Utils/AMDGPUEmitPrintf.cpp
index 9210096c4f3e1..8cd16ca3906f1 100644
--- a/llvm/lib/Transforms/Utils/AMDGPUEmitPrintf.cpp
+++ b/llvm/lib/Transforms/Utils/AMDGPUEmitPrintf.cpp
@@ -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.
diff --git a/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp b/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
index 42f27bc617591..2f851c4832f84 100644
--- a/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
+++ b/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
@@ -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);
More information about the llvm-commits
mailing list