aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2007-06-04 23:34:56 +0000
committerOwen Anderson <resistor@mac.com>2007-06-04 23:34:56 +0000
commitdbc705b73f288f4c4c921c6d591b6aefc891c122 (patch)
tree3d81cace030d43aaa3367d31b6a8d9f2d0e0121d
parent082fe7185eb140d5425f2316ac457bac56a0bad3 (diff)
Don't use std::set_difference when the two sets are sorted differently. Compute
the difference manually instead. This allows GVNPRE to produce correct analysis for the example in the GVNPRE paper. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37425 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Transforms/Scalar/GVNPRE.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/Transforms/Scalar/GVNPRE.cpp b/lib/Transforms/Scalar/GVNPRE.cpp
index 4f327663c1..2bedd1cdea 100644
--- a/lib/Transforms/Scalar/GVNPRE.cpp
+++ b/lib/Transforms/Scalar/GVNPRE.cpp
@@ -420,13 +420,12 @@ bool GVNPRE::runOnFunction(Function &F) {
s_ins, ExprLT());
anticIn.clear();
- std::insert_iterator<std::set<Value*, ExprLT> > antic_ins(anticIn,
- anticIn.begin());
- std::set_difference(S.begin(), S.end(),
- generatedTemporaries[BB].begin(),
- generatedTemporaries[BB].end(),
- antic_ins,
- ExprLT());
+
+ for (std::set<Value*, ExprLT>::iterator I = S.begin(), E = S.end();
+ I != E; ++I) {
+ if (generatedTemporaries[BB].find(*I) == generatedTemporaries[BB].end())
+ anticIn.insert(*I);
+ }
clean(VN, anticIn);