[llvm] [GlobalOpt] Handle operators separately when removing GV users (PR #84694)
Eli Friedman via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 17 23:40:38 PDT 2024
================
@@ -202,60 +212,51 @@ CleanupPointerRootUsers(GlobalVariable *GV,
bool Changed = false;
- // If Dead[n].first is the only use of a malloc result, we can delete its
- // chain of computation and the store to the global in Dead[n].second.
- SmallVector<std::pair<Instruction *, Instruction *>, 32> Dead;
+ auto RemoveComputationChain = [&GetTLI](Instruction *I) {
+ do {
+ if (isAllocationFn(I, GetTLI))
+ break;
+ Instruction *J = dyn_cast<Instruction>(I->getOperand(0));
----------------
efriedma-quic wrote:
Can this cast actually fail? isSafeComputationToRemove is supposed to check for a series of single-operand operations leading to an allocation.
https://github.com/llvm/llvm-project/pull/84694
More information about the llvm-commits
mailing list