[llvm] fbeda97 - InstCombine: Drop some typed pointer cast handling
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 31 07:34:36 PDT 2023
Author: Matt Arsenault
Date: 2023-07-31T10:34:31-04:00
New Revision: fbeda975d2880eafe9bb8a8f5c6a7d87268ee57c
URL: https://github.com/llvm/llvm-project/commit/fbeda975d2880eafe9bb8a8f5c6a7d87268ee57c
DIFF: https://github.com/llvm/llvm-project/commit/fbeda975d2880eafe9bb8a8f5c6a7d87268ee57c.diff
LOG: InstCombine: Drop some typed pointer cast handling
Added:
Modified:
llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp b/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
index 5694e7ef79b64f..7be077162c15ef 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
@@ -507,8 +507,6 @@ Instruction *InstCombinerImpl::visitAllocaInst(AllocaInst &AI) {
// types.
const Align MaxAlign = std::max(EntryAI->getAlign(), AI.getAlign());
EntryAI->setAlignment(MaxAlign);
- if (AI.getType() != EntryAI->getType())
- return new BitCastInst(EntryAI, AI.getType());
return replaceInstUsesWith(AI, EntryAI);
}
}
@@ -534,13 +532,11 @@ Instruction *InstCombinerImpl::visitAllocaInst(AllocaInst &AI) {
LLVM_DEBUG(dbgs() << "Found alloca equal to global: " << AI << '\n');
LLVM_DEBUG(dbgs() << " memcpy = " << *Copy << '\n');
unsigned SrcAddrSpace = TheSrc->getType()->getPointerAddressSpace();
- auto *DestTy = PointerType::get(AI.getAllocatedType(), SrcAddrSpace);
if (AI.getAddressSpace() == SrcAddrSpace) {
for (Instruction *Delete : ToDelete)
eraseInstFromFunction(*Delete);
- Value *Cast = Builder.CreateBitCast(TheSrc, DestTy);
- Instruction *NewI = replaceInstUsesWith(AI, Cast);
+ Instruction *NewI = replaceInstUsesWith(AI, TheSrc);
eraseInstFromFunction(*Copy);
++NumGlobalCopies;
return NewI;
@@ -551,8 +547,7 @@ Instruction *InstCombinerImpl::visitAllocaInst(AllocaInst &AI) {
for (Instruction *Delete : ToDelete)
eraseInstFromFunction(*Delete);
- Value *Cast = Builder.CreateBitCast(TheSrc, DestTy);
- PtrReplacer.replacePointer(Cast);
+ PtrReplacer.replacePointer(TheSrc);
++NumGlobalCopies;
}
}
More information about the llvm-commits
mailing list