[PATCH] D99846: [GlobalOpt] Replace recursion with extended worklist

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 4 02:41:49 PDT 2021


lebedev.ri added inline comments.


================
Comment at: llvm/lib/Transforms/IPO/GlobalOpt.cpp:336-339
       if (CE->use_empty()) {
         CE->destroyConstant();
         Changed = true;
       }
----------------
jdoerfert wrote:
> lebedev.ri wrote:
> > We need to track hopefully-dead-in-the-end instrs in some vector, and delete them if they are unused.
> Not totally sure what you want me to do.
> 
> TBH, I thought this would help me but it turns out some dead-constant user that are floating around prevent my global array from ever making it this far.
> 
> I'll clean up my Attributor code and get rid of my global arrays. Also need to do some value prop through another one that is not picked up IPSCCP, so might be worth to find a wholesome solution.
Previously, `CE` would not have users by now because we recursed,
and got to the condition after we've dealt with it's users.
Now, we get here after we enqueue it's users,
so naturally, it won't have no users by now.
So we need to defer it's destruction until after we've done with the worklist.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99846/new/

https://reviews.llvm.org/D99846



More information about the llvm-commits mailing list