[PATCH] D37163: [LICM] sink through non-trivially replicable PHI

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 29 11:59:52 PDT 2017


efriedma added inline comments.


================
Comment at: lib/Transforms/Scalar/LICM.cpp:803
+  Instruction *New;
+  auto It = SunkCopies.find(ExitBlock);
+  if (It != SunkCopies.end())
----------------
junbuml wrote:
> efriedma wrote:
> > Do you need to do something to keep SunkCopies up to date?
> This is to clone only one instruction per exit block and I couldn't think of a case where the same instruction is cloned several times in the same exit block. Please let me know if you can see any case where we need to update SunkCopies.
The reason the SunkCopies map exists is that there could be multiple PHI nodes which use the same instruction in a loop exit block.

Maybe it would be more straightforward if you would make all the necessary calls to splitPredecessorsOfLoopExit before you actually start sinking instructions?


https://reviews.llvm.org/D37163





More information about the llvm-commits mailing list