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

Dale Johannesen dalej at apple.com
Thu Mar 5 16:42:51 PST 2009


Author: johannes
Date: Thu Mar  5 18:42:50 2009
New Revision: 66225

URL: http://llvm.org/viewvc/llvm-project?rev=66225&view=rev
Log:
Tweak the check for promotable alloca's to handle
debug intrinsics correctly.


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=66225&r1=66224&r2=66225&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp Thu Mar  5 18:42:50 2009
@@ -81,9 +81,15 @@
       if (SI->isVolatile())
         return false;
     } else if (const BitCastInst *BC = dyn_cast<BitCastInst>(*UI)) {
-      // Uses by dbg info shouldn't inhibit promotion.
+      // A bitcast that does not feed into debug info inhibits promotion.
       if (!BC->hasOneUse() || !isa<DbgInfoIntrinsic>(*BC->use_begin()))
         return false;
+      // If the only use is by debug info, this alloca will not exist in
+      // non-debug code, so don't try to promote; this ensures the same
+      // codegen with debug info.  Otherwise, debug info should not
+      // inhibit promotion (but we must examine other uses).
+      if (AI->hasOneUse())
+        return false;
     } else {
       return false;
     }





More information about the llvm-commits mailing list