diff options
author | Sebastian Pop <sebpop@gmail.com> | 2016-08-03 20:54:38 +0000 |
---|---|---|
committer | Sebastian Pop <sebpop@gmail.com> | 2016-08-03 20:54:38 +0000 |
commit | 2aadad7243aef94914eb0b383496cd230a2629fb (patch) | |
tree | 9ae8caa0ef8c33d3bdcc14f3b4544333262e5af5 /llvm/lib/Transforms | |
parent | 4ba7c88cc701bf4804f3072607f84fb5ff2e7482 (diff) | |
download | bcm5719-llvm-2aadad7243aef94914eb0b383496cd230a2629fb.tar.gz bcm5719-llvm-2aadad7243aef94914eb0b383496cd230a2629fb.zip |
GVN-hoist: limit the length of dependent instructions
Limit the number of times the while(1) loop is executed. With this restriction
the number of hoisted instructions does not change in a significant way on the
test-suite.
Differential Revision: https://reviews.llvm.org/D23028
llvm-svn: 277651
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/Scalar/GVNHoist.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/GVNHoist.cpp b/llvm/lib/Transforms/Scalar/GVNHoist.cpp index 2ddec453edb..19632d637fa 100644 --- a/llvm/lib/Transforms/Scalar/GVNHoist.cpp +++ b/llvm/lib/Transforms/Scalar/GVNHoist.cpp @@ -53,6 +53,11 @@ static cl::opt<int> MaxDepthInBB( cl::desc("Hoist instructions from the beginning of the BB up to the " "maximum specified depth (default = 100, unlimited = -1)")); +static cl::opt<int> MaxChainLength( + "gvn-hoist-max-chain-length", cl::Hidden, cl::init(10), + cl::desc("Maximum length of dependent chains to hoist " + "(default = 10, unlimited = -1)")); + namespace { // Provides a sorting function based on the execution order of two instructions. @@ -212,8 +217,13 @@ public: DFSNumber[&Inst] = ++I; } + int ChainLength = 0; + // FIXME: use lazy evaluation of VN to avoid the fix-point computation. while (1) { + if (MaxChainLength != -1 && ++ChainLength >= MaxChainLength) + return Res; + auto HoistStat = hoistExpressions(F); if (HoistStat.first + HoistStat.second == 0) return Res; |