diff options
| author | Daniil Fukalov <daniil.fukalov@amd.com> | 2017-01-26 13:33:17 +0000 |
|---|---|---|
| committer | Daniil Fukalov <daniil.fukalov@amd.com> | 2017-01-26 13:33:17 +0000 |
| commit | b09dac59fc7b988fd4062345108f54b2520edf3d (patch) | |
| tree | a6cb2995ac634d532354c090fabb2a0d3f4292e6 /llvm/lib/Analysis | |
| parent | 3057fd53f969bec658f45640d333faa8b8843cb3 (diff) | |
| download | bcm5719-llvm-b09dac59fc7b988fd4062345108f54b2520edf3d.tar.gz bcm5719-llvm-b09dac59fc7b988fd4062345108f54b2520edf3d.zip | |
[SCEV] Introduce add operation inlining limit
Inlining in getAddExpr() can cause abnormal computational time in some cases.
New parameter -scev-addops-inline-threshold is intruduced with default value 500.
Reviewers: sanjoy
Subscribers: mzolotukhin, llvm-commits
Differential Revision: https://reviews.llvm.org/D28812
llvm-svn: 293176
Diffstat (limited to 'llvm/lib/Analysis')
| -rw-r--r-- | llvm/lib/Analysis/ScalarEvolution.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp index 18fcb0e85b6..ee09c8f3c01 100644 --- a/llvm/lib/Analysis/ScalarEvolution.cpp +++ b/llvm/lib/Analysis/ScalarEvolution.cpp @@ -127,6 +127,11 @@ static cl::opt<unsigned> MulOpsInlineThreshold( cl::desc("Threshold for inlining multiplication operands into a SCEV"), cl::init(1000)); +static cl::opt<unsigned> AddOpsInlineThreshold( + "scev-addops-inline-threshold", cl::Hidden, + cl::desc("Threshold for inlining multiplication operands into a SCEV"), + cl::init(500)); + static cl::opt<unsigned> MaxCompareDepth("scalar-evolution-max-compare-depth", cl::Hidden, cl::desc("Maximum depth of recursive compare complexity"), @@ -2219,6 +2224,9 @@ const SCEV *ScalarEvolution::getAddExpr(SmallVectorImpl<const SCEV *> &Ops, if (Idx < Ops.size()) { bool DeletedAdd = false; while (const SCEVAddExpr *Add = dyn_cast<SCEVAddExpr>(Ops[Idx])) { + if (Ops.size() > AddOpsInlineThreshold || + Add->getNumOperands() > AddOpsInlineThreshold) + break; // If we have an add, expand the add operands onto the end of the operands // list. Ops.erase(Ops.begin()+Idx); |

