[llvm] [SCCP] Remove LoadInst if it loaded from Constant GlobalVariable (PR #107245)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 5 10:30:49 PDT 2024
================
@@ -356,9 +356,13 @@ static bool runIPSCCP(
continue;
LLVM_DEBUG(dbgs() << "Found that GV '" << GV->getName()
<< "' is constant!\n");
- while (!GV->use_empty()) {
- StoreInst *SI = cast<StoreInst>(GV->user_back());
- SI->eraseFromParent();
+ for (User *U : make_early_inc_range(GV->users())) {
+ // We can remove LoadInst at here, because we already replace user of this
+ // to constant.
----------------
ParkHanbum wrote:
thanks @nikic !
https://github.com/llvm/llvm-project/pull/107245
More information about the llvm-commits
mailing list