[llvm-commits] CVS: llvm/lib/Transforms/Scalar/GVNPRE.cpp

Owen Anderson resistor at mac.com
Mon Jun 4 16:35:18 PDT 2007



Changes in directory llvm/lib/Transforms/Scalar:

GVNPRE.cpp updated: 1.17 -> 1.18
---
Log message:

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.


---
Diffs of the changes:  (+6 -7)

 GVNPRE.cpp |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)


Index: llvm/lib/Transforms/Scalar/GVNPRE.cpp
diff -u llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.17 llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.18
--- llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.17	Mon Jun  4 18:28:33 2007
+++ llvm/lib/Transforms/Scalar/GVNPRE.cpp	Mon Jun  4 18:34:56 2007
@@ -420,13 +420,12 @@
                      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);
       






More information about the llvm-commits mailing list