[PATCH] D26490: [GVN, OptDiag] Print the interesting instructions involved in missed load-elimination

Adam Nemet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 28 15:33:23 PST 2016


anemet added inline comments.


================
Comment at: lib/Transforms/Scalar/GVN.cpp:1217
+  using namespace ore;
+  for (auto *U : LI->getPointerOperand()->users())
+    if (U != LI && (isa<LoadInst>(U) || isa<StoreInst>(U)) &&
----------------
hfinkel wrote:
> This iteration order is going to be non-deterministic if there are multiple users; I don't think we can do it this way. Plus, this won't really give the best answer. Unfortunately, actually giving the best answer probably needs to wait for MemorySSA/NewGVN (because looking at other pointer uses won't pick up cases where a smaller load is replaced by part of a larger store, etc.). In the mean time, can we do something deterministic (e.g. sort the other instructions by dominance, pick the last instruction in the last block (perhaps making use of OrderedBasicBlock))?
Thanks, you're right.  For now I just bail if there are more than one other users.

I expect this won't be effective so we will soon have to add the analysis you're suggesting. 


https://reviews.llvm.org/D26490





More information about the llvm-commits mailing list