[llvm] [DFAJumpThreading] Add an early exit heuristic for unpredictable values (PR #85015)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 14 04:01:13 PDT 2024
================
@@ -439,18 +449,31 @@ struct MainSwitch {
// initial switch values that can be ignored (they will hit the
// unthreaded switch) but this assumption will get checked later after
// paths have been enumerated (in function getStateDefMap).
+
+ // If the unpredictable value comes from the same inner loop it is
+ // likely that it will also be on the enumerated paths, causing us to
+ // exit after we have enumerated all the paths. This heuristic save
+ // compile time because a search for all the paths can become expensive.
+ if (EarlyExitHeuristic && LI->getLoopFor(SI->getParent()) ==
+ LI->getLoopFor(CurrentIncomingBB)) {
----------------
nikic wrote:
Also, what about the case where the incoming BB is a sub-loop? Wouldn't we want to bail out in that case as well?
https://github.com/llvm/llvm-project/pull/85015
More information about the llvm-commits
mailing list