[PATCH] D54223: [SimpleLoopUnswitch] adding cost multiplier to cap exponential unswitch with

Chandler Carruth via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 12 07:43:21 PST 2018


chandlerc accepted this revision.
chandlerc added a comment.
This revision is now accepted and ready to land.

I think this is looking pretty good as an initial cut. I'm still very interested in follow-ups to use a more precise heuristic of course, but I think those can be follow-ups.

Make sure to sync with Max before landing to make sure he's OK with the current state.



================
Comment at: lib/Transforms/Scalar/SimpleLoopUnswitch.cpp:82-85
+static cl::opt<int> UnswitchCandidatesBottomCap(
+    "unswitch-candidates-bottom-cap", cl::init(8), cl::Hidden,
+    cl::desc("Amount of unswitch candidates that are ignored when calculating "
+             "cost multiplier."));
----------------
Maybe `UnswitchNumInitialUnscaledCandidates` for a name?


================
Comment at: lib/Transforms/Scalar/SimpleLoopUnswitch.cpp:2300-2301
+  // of candidates is small.
+  unsigned CandidatesPower = std::max(
+      (int)UnswitchCandidates.size() - (int)UnswitchCandidatesBottomCap, 0);
+
----------------
Just return here?


Repository:
  rL LLVM

https://reviews.llvm.org/D54223





More information about the llvm-commits mailing list