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

Hal Finkel via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 22 06:45:39 PST 2016


hfinkel 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)) &&
----------------
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))?


https://reviews.llvm.org/D26490





More information about the llvm-commits mailing list