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

Jun Bum Lim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 30 08:35:25 PDT 2017


junbuml added inline comments.


================
Comment at: lib/Transforms/Scalar/LICM.cpp:803
+  Instruction *New;
+  auto It = SunkCopies.find(ExitBlock);
+  if (It != SunkCopies.end())
----------------
efriedma wrote:
> 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?
Now, I split non-trivially replaceable PHIs before sinking in sink(). Please take a look and let me know any comment. Thanks Eli for the review.


https://reviews.llvm.org/D37163





More information about the llvm-commits mailing list