[PATCH] D107397: [GlobalOpt] Fix the load types when OptimizeGlobalAddressOfMalloc
Shimin Cui via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 3 15:11:36 PDT 2021
scui added inline comments.
================
Comment at: llvm/lib/Transforms/IPO/GlobalOpt.cpp:1000
LoadInst *LI = cast<LoadInst>(U);
- while (!LI->use_empty()) {
- Use &LoadUse = *LI->use_begin();
- ICmpInst *ICI = dyn_cast<ICmpInst>(LoadUse.getUser());
+ for (Use &LU : llvm::make_early_inc_range(LI->uses())) {
+ ICmpInst *ICI = dyn_cast<ICmpInst>(LU.getUser());
----------------
efriedma wrote:
> Why do you need to mess with the way you're iterating over the uses of LI? Calling ConstantExpr::getBitCast() doesn't mess with the use-list of LI.
I guess I have a preference on for loop. I'll change it back.
================
Comment at: llvm/lib/Transforms/IPO/GlobalOpt.cpp:1004
+ // Simply replace the use by the NewGV.
+ LU.set(ConstantExpr::getBitCast(NewGV, LI->getType()));
continue;
----------------
efriedma wrote:
> Is RepValue dead with this change?
Will add code to make use of it like the original code.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D107397/new/
https://reviews.llvm.org/D107397
More information about the llvm-commits
mailing list