[PATCH] D44160: [GVN] Don't use the eliminated load as an available value in phi construction

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 20 15:25:53 PDT 2018


reames accepted this revision.
reames added a comment.
This revision is now accepted and ready to land.

LGTM



================
Comment at: lib/Transforms/Scalar/GVN.cpp:769
 
+    // If the value is the load that we will be eliminating, and the block it's
+    // available in is the block that the load is in, then don't add it as
----------------
john.brawn wrote:
> reames wrote:
> > Don't you need to add the original LI to the SSA updater at least once?  Starting at the original block?
> There's no inherent need to do that, I'm pretty sure. Adding LI to the SSA updater really means adding the value that LI will be replaced with, which is exactly what the SSA updater is itself deciding. So adding LI as available value in the block it's in is like saying "the value in this block is the value that's going to be in this block", and the SSA updater already knows that.
You are correct.  I was confusing myself by thinking the following two (wrong) things:
1) That we still had to reason about potentially unavailable blocks at this point.
2) That there might be store somewhere in the block.  (Can't because otherwise we'd not have circled all the way around.)


Repository:
  rL LLVM

https://reviews.llvm.org/D44160





More information about the llvm-commits mailing list