[PATCH] D73741: [SCEV] SCEVExpander::isHighCostExpansionHelper(): cost-model polynomial recurrence

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 24 22:07:58 PST 2020


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

LGTM



================
Comment at: llvm/lib/Analysis/ScalarEvolutionExpander.cpp:2246
+    // Ignoring constant term (operand 0), how many of the coeffients are u> 1?
+    int NumNonZeroDegreeTerms =
+        llvm::count_if(make_range(std::next(NAry->op_begin()), NAry->op_end()),
----------------
This variable name is somewhat misleading, it should clearly say that it only counts non-one coefficients.


================
Comment at: llvm/lib/Analysis/ScalarEvolutionExpander.cpp:2259
+    int PolyDegree = NAry->getNumOperands() - 1;
+    assert(PolyDegree >= 1 && "Should be at least affine.");
+
----------------
Maybe also assert that the last operand is not zero (trailing zeros should be thrown away on SCEV creation).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73741/new/

https://reviews.llvm.org/D73741





More information about the llvm-commits mailing list