summaryrefslogtreecommitdiffstats
path: root/lib/Transforms/Scalar
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2008-08-26 22:07:42 +0000
committerOwen Anderson <resistor@mac.com>2008-08-26 22:07:42 +0000
commit516eb1c1396bc0a2b35573e58c567d6092ed5fd0 (patch)
tree3883346488deb26cd7b951ad7568a7e3378bcdeb /lib/Transforms/Scalar
parent3200d92947cd64f82ca748d65d1e58c3d45f440f (diff)
downloadexternal_llvm-516eb1c1396bc0a2b35573e58c567d6092ed5fd0.zip
external_llvm-516eb1c1396bc0a2b35573e58c567d6092ed5fd0.tar.gz
external_llvm-516eb1c1396bc0a2b35573e58c567d6092ed5fd0.tar.bz2
Put a heuristic in place to prevent GVN from falling into bad cases with massively complicated CFGs.
This speeds up a particular testcase from 12+ hours to 5 seconds with little perceptible loss of quality. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55391 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar')
-rw-r--r--lib/Transforms/Scalar/GVN.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/GVN.cpp b/lib/Transforms/Scalar/GVN.cpp
index 272ad1b..42fbc78 100644
--- a/lib/Transforms/Scalar/GVN.cpp
+++ b/lib/Transforms/Scalar/GVN.cpp
@@ -862,6 +862,12 @@ bool GVN::processNonLocalLoad(LoadInst* L,
DenseMap<BasicBlock*, Value*> deps;
MD.getNonLocalDependency(L, deps);
+ // If we had to process more than one hundred blocks to find the
+ // dependencies, this load isn't worth worrying about. Optimizing
+ // it will be too expensive.
+ if (deps.size() > 100)
+ return false;
+
DenseMap<BasicBlock*, Value*> repl;
// Filter out useless results (non-locals, etc)