[llvm-commits] [llvm] r40813 - /llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp

Chris Lattner sabre at nondot.org
Fri Aug 3 19:45:07 PDT 2007


Author: lattner
Date: Fri Aug  3 21:45:02 2007
New Revision: 40813

URL: http://llvm.org/viewvc/llvm-project?rev=40813&view=rev
Log:
fix a logic bug where we wouldn't promote single store allocas if the 
stored value was a non-instruction value.  Doh.

This increase the # single store allocas from 8982 to 9026, and
speeds up mem2reg on the testcase in PR1432 from 2.17 to 2.13s.

Modified:
    llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp

Modified: llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp?rev=40813&r1=40812&r2=40813&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp Fri Aug  3 21:45:02 2007
@@ -557,7 +557,7 @@
     // do so now.  We can't handle the case where the store doesn't dominate a
     // block because there may be a path between the store and the use, but we
     // may need to insert phi nodes to handle dominance properly.
-    if (StoringGlobalVal || !dominates(OnlyStore->getParent(), UseBlock))
+    if (!StoringGlobalVal && !dominates(OnlyStore->getParent(), UseBlock))
       continue;
     
     // If the use and store are in the same block, do a quick scan to
@@ -569,7 +569,7 @@
           break;
       }
       if (&*I != OnlyStore)
-        break;  // Do not handle this alloca.
+        continue;  // Do not promote the uses of this in this block.
     }
     
     // Otherwise, if this is a different block or if all uses happen





More information about the llvm-commits mailing list