diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2007-08-18 23:18:03 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2007-08-18 23:18:03 +0000 |
commit | c721223f7379229f6d813051bb94c999dd693073 (patch) | |
tree | 93deec2d0520a8ae13667fad42e064b918c76728 /lib/Transforms/Scalar/PredicateSimplifier.cpp | |
parent | af5cbc82bb6410129425c98bbfc1ffc4c3d0f411 (diff) | |
download | external_llvm-c721223f7379229f6d813051bb94c999dd693073.tar.gz external_llvm-c721223f7379229f6d813051bb94c999dd693073.tar.bz2 external_llvm-c721223f7379229f6d813051bb94c999dd693073.zip |
Never insert duplicate edges.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41169 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/PredicateSimplifier.cpp')
-rw-r--r-- | lib/Transforms/Scalar/PredicateSimplifier.cpp | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/lib/Transforms/Scalar/PredicateSimplifier.cpp b/lib/Transforms/Scalar/PredicateSimplifier.cpp index 972e875d4b..e27bac50d7 100644 --- a/lib/Transforms/Scalar/PredicateSimplifier.cpp +++ b/lib/Transforms/Scalar/PredicateSimplifier.cpp @@ -711,23 +711,27 @@ namespace { ++J; } - if (J != E && J->To == n && J->Subtree->dominates(Subtree)) { + if (J != E && J->To == n) { + assert(J->Subtree->dominates(Subtree)); + edge.LV = static_cast<LatticeVal>(J->LV & R); assert(validPredicate(edge.LV) && "Invalid union of lattice values."); - if (edge.LV != J->LV) { - - // We have to tighten any edge beneath our update. - for (iterator K = I; K->To == n; --K) { - if (K->Subtree->DominatedBy(Subtree)) { - LatticeVal LV = static_cast<LatticeVal>(K->LV & edge.LV); - assert(validPredicate(LV) && "Invalid union of lattice values"); - K->LV = LV; - } - if (K == B) break; - } + if (edge.LV == J->LV) + return; // This update adds nothing new. + } + + if (I != B) { + // We also have to tighten any edge beneath our update. + for (iterator K = I - 1; K->To == n; --K) { + if (K->Subtree->DominatedBy(Subtree)) { + LatticeVal LV = static_cast<LatticeVal>(K->LV & edge.LV); + assert(validPredicate(LV) && "Invalid union of lattice values"); + K->LV = LV; + } + if (K == B) break; } - } + } // Insert new edge at Subtree if it isn't already there. if (I == E || I->To != n || Subtree != I->Subtree) |