[PATCH] D38619: [GVN] Prevent ScalarPRE from hoisting across instructions that don't pass control flow to successors

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 3 11:22:13 PDT 2017


efriedma requested changes to this revision.
efriedma added inline comments.
This revision now requires changes to proceed.


================
Comment at: lib/Transforms/Scalar/GVN.cpp:2210
+    if (!IsSafeToSpeculativelyExecute && FirstImplicitControlFlowInsts.count(P))
+      return false;
     // We're not interested in PRE where blocks with predecessors that are
----------------
Err, wait, sorry, I wasn't reading carefully enough.

What are you trying to check for here?  I can't see why it matters if "P" has an implicit control flow instruction; we insert the new instruction at the end of the predecessor, so implicit control flow isn't a problem unless the terminator is an invoke.


https://reviews.llvm.org/D38619





More information about the llvm-commits mailing list