[PATCH] D44160: [GVN] Detect fully redundant loads when we have more than one available value

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 9 16:55:45 PDT 2018


reames added inline comments.


================
Comment at: lib/Transforms/Scalar/GVN.cpp:786
       continue;
 
     SSAUpdate.AddAvailableValue(BB, AV.MaterializeAdjustedValue(LI, gvn));
----------------
Maybe I'm missing something, but couldn't we get the same effect you're looking for by adding the check for LI as our AV into this loop?  This would have the effect of telling the SSAUpdator about only one def in your example which should avoid the need for any phi creation.

Then there's no concern about change in O() since this loop is already O(ValuesPerBloc).  

To be clear, I don't really care about the side effect of "fixing" AA, but reducing redundant IR always seems like a win since it's likely to let the rest of the GVN run be more effective.  


Repository:
  rL LLVM

https://reviews.llvm.org/D44160





More information about the llvm-commits mailing list