aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/CodeGenPrepare.cpp
diff options
context:
space:
mode:
authorYoungsuk Kim <youngsuk.kim@hpe.com>2023-12-15 10:57:33 -0600
committerYoungsuk Kim <youngsuk.kim@hpe.com>2023-12-15 11:04:48 -0600
commit67aec2f58bf1568bb1c68d4906bc3c0103ff3c98 (patch)
tree7da5f872ccc574f045b02e94bbf8e6a038f35884 /llvm/lib/CodeGen/CodeGenPrepare.cpp
parent93b14c3df17500e675f31674165b5378dd0b4eaf (diff)
downloadllvm-67aec2f58bf1568bb1c68d4906bc3c0103ff3c98.zip
llvm-67aec2f58bf1568bb1c68d4906bc3c0103ff3c98.tar.gz
llvm-67aec2f58bf1568bb1c68d4906bc3c0103ff3c98.tar.bz2
[llvm] Remove no-op ptr-to-ptr casts (NFC)
Remove calls to CreatePointerCast which are just doing no-op ptr-to-ptr bitcasts. Opaque ptr cleanup effort (NFC).
Diffstat (limited to 'llvm/lib/CodeGen/CodeGenPrepare.cpp')
-rw-r--r--llvm/lib/CodeGen/CodeGenPrepare.cpp10
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);