[llvm-commits] [llvm] r94194 - in /llvm/trunk/lib/Transforms: InstCombine/InstCombineLoadStoreAlloca.cpp Utils/PromoteMemoryToRegister.cpp

Victor Hernandez vhernandez at apple.com
Fri Jan 22 11:05:06 PST 2010


Author: hernande
Date: Fri Jan 22 13:05:05 2010
New Revision: 94194

URL: http://llvm.org/viewvc/llvm-project?rev=94194&view=rev
Log:
Keep ignoring pointer-to-pointer bitcasts

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

Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp?rev=94194&r1=94193&r2=94194&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp Fri Jan 22 13:05:05 2010
@@ -406,8 +406,10 @@
   for (unsigned ScanInsts = 6; BBI != SI.getParent()->begin() && ScanInsts;
        --ScanInsts) {
     --BBI;
-    // Don't count debug info directives, lest they affect codegen
-    if (isa<DbgInfoIntrinsic>(BBI)) {
+    // Don't count debug info directives, lest they affect codegen,
+    // and we skip pointer-to-pointer bitcasts, which are NOPs.
+    if (isa<DbgInfoIntrinsic>(BBI) ||
+        (isa<BitCastInst>(BBI) && isa<PointerType>(BBI->getType()))) {
       ScanInsts++;
       continue;
     }    
@@ -476,7 +478,8 @@
   BBI = &SI; 
   do {
     ++BBI;
-  } while (isa<DbgInfoIntrinsic>(BBI));
+  } while (isa<DbgInfoIntrinsic>(BBI) ||
+           (isa<BitCastInst>(BBI) && isa<PointerType>(BBI->getType())));
   if (BranchInst *BI = dyn_cast<BranchInst>(BBI))
     if (BI->isUnconditional())
       if (SimplifyStoreAtEndOfBlock(SI))
@@ -536,7 +539,8 @@
   if (OtherBr->isUnconditional()) {
     --BBI;
     // Skip over debugging info.
-    while (isa<DbgInfoIntrinsic>(BBI)) {
+    while (isa<DbgInfoIntrinsic>(BBI) ||
+           (isa<BitCastInst>(BBI) && isa<PointerType>(BBI->getType()))) {
       if (BBI==OtherBB->begin())
         return false;
       --BBI;

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

==============================================================================
--- llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp Fri Jan 22 13:05:05 2010
@@ -76,9 +76,6 @@
         return false;   // Don't allow a store OF the AI, only INTO the AI.
       if (SI->isVolatile())
         return false;
-    } else if (isa<BitCastInst>(*UI)) {
-      // A bitcast inhibits promotion.
-      return false;
     } else {
       return false;
     }





More information about the llvm-commits mailing list