[PATCH] D22143: [SimplifyCFG] Rewrite SinkThenElseCodeToEnd

Sebastian Pop via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 30 06:28:36 PDT 2016


sebpop added a subscriber: sebpop.
sebpop added a comment.

Hi James,

a big regression on a proprietary benchmark attracted my attention to your patch.
I need to do a bit more perf analysis to figure out why the regression happened.

Reading through the patch, I remembered my tries to make the CFG simplifier stronger
to catch a hoist testcase.  I think there are serious limitations to the CFG simplifier, and
also because it is called a gazillion times (after every other CFG transform pass), it may
be quite cost prohibitive to implement anything stronger than what it currently does.

I was wondering whether you would consider extending GVN-hoist to sink instructions?


================
Comment at: lib/Transforms/Utils/SimplifyCFG.cpp:1368
@@ +1367,3 @@
+  // Again, be super conservative. Ideally we'd be able to query AliasAnalysis
+  // but we currently don't have that available.
+  if (std::any_of(std::next(I0->getIterator()), At0, [](const Instruction &I) {
----------------
Have you considered implementing sinking in the GVN-hoist pass?
That would make sinking more powerful as it works on MemorySSA,
more general by handling switch stmts, and arbitrarily complex CFG.

Sinking candidates are already detected as equivalent expressions
by the hoister using value numbering.  In some cases some expressions
can only be sinked because of side effects in the upper CFG: those are
good candidates to be sinked if there are no hazards below.


Repository:
  rL LLVM

https://reviews.llvm.org/D22143





More information about the llvm-commits mailing list