[llvm-commits] [llvm] r97526 - /llvm/trunk/lib/Transforms/Scalar/GVN.cpp

Bob Wilson bob.wilson at apple.com
Mon Mar 1 16:09:30 PST 2010


Author: bwilson
Date: Mon Mar  1 18:09:29 2010
New Revision: 97526

URL: http://llvm.org/viewvc/llvm-project?rev=97526&view=rev
Log:
Don't attempt load PRE when there is no real redundancy (i.e., the load is in
a loop and is itself the only dependency).

Modified:
    llvm/trunk/lib/Transforms/Scalar/GVN.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GVN.cpp?rev=97526&r1=97525&r2=97526&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/GVN.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/GVN.cpp Mon Mar  1 18:09:29 2010
@@ -1542,11 +1542,13 @@
   // at least one of the values is LI.  Since this means that we won't be able
   // to eliminate LI even if we insert uses in the other predecessors, we will
   // end up increasing code size.  Reject this by scanning for LI.
-  if (!EnableFullLoadPRE) {
-    for (unsigned i = 0, e = ValuesPerBlock.size(); i != e; ++i)
-      if (ValuesPerBlock[i].isSimpleValue() &&
-          ValuesPerBlock[i].getSimpleValue() == LI)
+  for (unsigned i = 0, e = ValuesPerBlock.size(); i != e; ++i) {
+    if (ValuesPerBlock[i].isSimpleValue() &&
+        ValuesPerBlock[i].getSimpleValue() == LI) {
+      // Skip cases where LI is the only definition, even for EnableFullLoadPRE.
+      if (!EnableFullLoadPRE || e == 1)
         return false;
+    }
   }
 
   // FIXME: It is extremely unclear what this loop is doing, other than





More information about the llvm-commits mailing list