[llvm] [polly] [llvm][ConstraintElimination]Insert ConditionFact into loop header in case of monotonic induction variables (PR #112080)

Matthias Braun via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 31 13:34:42 PDT 2024


================
@@ -1680,7 +1761,9 @@ static bool eliminateConstraints(Function &F, DominatorTree &DT, LoopInfo &LI,
   for (Value &Arg : F.args())
     FunctionArgs.push_back(&Arg);
   ConstraintInfo Info(F.getDataLayout(), FunctionArgs);
-  State S(DT, LI, SE);
+  unsigned int NumCondBranches = getNumConditionalBranches(F);
+  State S(DT, LI, SE,
+          /* AddInductionInfoIntoHeader= */ NumCondBranches < MaxRows / 5);
----------------
MatzeB wrote:

I was not aware of the existing `MaxRows` mechanism during my earlier review, so that seems to be already enough to avoid compile-time explosion.

Doing a whole walk over the function to count conditional branches feels somewhat heavy and we potentially get an amount of facts in the number of `Phi` instructions (which isn't necessarily correlated to number of condjumps). Anyway just trying to make a case that maybe we should just do the simpler thing and rely on `MaxRows` limiting things without adding extra conditions here.

https://github.com/llvm/llvm-project/pull/112080


More information about the llvm-commits mailing list