[PATCH] D34397: [SCEV] Make MulOpsInlineThreshold lower to avoid excessive compilation time

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 20 05:28:21 PDT 2017


mkazantsev created this revision.
Herald added a subscriber: mzolotukhin.

MulOpsInlineThreshold option of SCEV is defaulted to 1000, which is inadequately high.
When constructing SCEVs of expressions like:

  x1 = a * a
  x2 = x1 * x1
  x3 = x2 * x2
    ...

We actually have huge SCEVs with max allowed amount of operands inlined.
Such expressions are easy to get from unrolling of loops looking like

  x = a
  for (i = 0; i < n; i++)
    x = x * x

Or more tricky cases where big powers are involved. If some non-linear analysis
tries to work with a SCEV that has 1000 operands, it may lead to excessively long
compilation. The attached test does not pass within 1 minute with default threshold.

This patch decreases its default value to 32, which looks much more reasonable if we
use analyzes with complexity O(N^2) or O(N^3) working with SCEV.


https://reviews.llvm.org/D34397

Files:
  lib/Analysis/ScalarEvolution.cpp
  test/Transforms/IndVarSimplify/huge_muls.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34397.103187.patch
Type: text/x-patch
Size: 4405 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170620/676da3f8/attachment.bin>


More information about the llvm-commits mailing list