[PATCH] D53747: [NFC][SimpleLoopUnswitch] Make all checks before actual non-trivial unswitch

Chandler Carruth via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 26 01:53:20 PDT 2018


chandlerc added a comment.

FWIW, after my suggestion I would not call this "NFC" as it should change the cost function of this routine at least....



================
Comment at: lib/Transforms/Scalar/SimpleLoopUnswitch.cpp:2368-2376
+  // We cannot unswitch if exit blocks contain a cleanuppad instruction as we
+  // don't know how to split those exit blocks.
+  // FIXME: We should teach SplitBlock to handle this and remove this
+  // restriction.
+  for (auto *ExitBB : ExitBlocks)
+    if (isa<CleanupPadInst>(ExitBB->getFirstNonPHI())) {
+      dbgs() << "Cannot unswitch because of cleanuppad in exit block\n";
----------------
Can we hoist this even fiurther up? Maybe w/ the irreducible CFG?

We shouldn't even compute and rank the cost of the candidates when this is the case.

The reason this was inside the unswitch (ages ago) was because we were re-using teh exit blocks list and I didn't want to create it twice, but your solution of passing it in seems way better.


https://reviews.llvm.org/D53747





More information about the llvm-commits mailing list