diff options
author | Owen Anderson <resistor@mac.com> | 2008-08-26 22:07:42 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2008-08-26 22:07:42 +0000 |
commit | b39e0decf88a0de82e836de3ca7e9c9a60e65f58 (patch) | |
tree | a0992e5f0685e67ea999fe3565a1516b3435ed9f /llvm/lib/Transforms/Scalar/GVN.cpp | |
parent | 3c76cb5cadb45bf8d2606411765ce724b460a147 (diff) | |
download | bcm5719-llvm-b39e0decf88a0de82e836de3ca7e9c9a60e65f58.tar.gz bcm5719-llvm-b39e0decf88a0de82e836de3ca7e9c9a60e65f58.zip |
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.
llvm-svn: 55391
Diffstat (limited to 'llvm/lib/Transforms/Scalar/GVN.cpp')
-rw-r--r-- | llvm/lib/Transforms/Scalar/GVN.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/GVN.cpp b/llvm/lib/Transforms/Scalar/GVN.cpp index 272ad1b99b9..42fbc78671e 100644 --- a/llvm/lib/Transforms/Scalar/GVN.cpp +++ b/llvm/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) |