OSDN Git Service

[SCEV] Prohibit SCEV transformations for huge SCEVs
authorMax Kazantsev <max.kazantsev@azul.com>
Thu, 31 Jan 2019 06:19:25 +0000 (06:19 +0000)
committerMax Kazantsev <max.kazantsev@azul.com>
Thu, 31 Jan 2019 06:19:25 +0000 (06:19 +0000)
commit19f02ae8c16284077187b5793524b9f617646af3
tree8497d47c4e7711411383d2752b7e256f236b51a5
parent18fe2c5936a77484261539c570fecd6be33c476c
[SCEV] Prohibit SCEV transformations for huge SCEVs

Currently SCEV attempts to limit transformations so that they do not work with
big SCEVs (that may take almost infinite compile time). But for this, it uses heuristics
such as recursion depth and number of operands, which do not give us a guarantee
that we don't actually have big SCEVs. This situation is still possible, though it is not
likely to happen. However, the bug PR33494 showed a bunch of simple corner case
tests where we still produce huge SCEVs, even not reaching big recursion depth etc.

This patch introduces a concept of 'huge' SCEVs. A SCEV is huge if its expression
size (intoduced in D35989) exceeds some threshold value. We prohibit optimizing
transformations if any of SCEVs we are dealing with is huge. This gives us a reliable
check that we don't spend too much time working with them.

As the next step, we can possibly get rid of old limiting mechanisms, such as recursion
depth thresholds.

Differential Revision: https://reviews.llvm.org/D35990
Reviewed By: reames

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352728 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Analysis/ScalarEvolution.cpp
test/Analysis/ScalarEvolution/huge_expression_limit.ll [new file with mode: 0644]
test/Transforms/LoopStrengthReduce/X86/bin_power.ll