[llvm-commits] [llvm] r82935 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp

Chris Lattner sabre at nondot.org
Sun Sep 27 14:42:46 PDT 2009


Author: lattner
Date: Sun Sep 27 16:42:46 2009
New Revision: 82935

URL: http://llvm.org/viewvc/llvm-project?rev=82935&view=rev
Log:
The bitcast case is not needed here: instcombine turns icmp(bitcast(x), null) -> icmp(x, null) already.  

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

Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=82935&r1=82934&r2=82935&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Sun Sep 27 16:42:46 2009
@@ -6289,19 +6289,6 @@
                                                       !I.isTrueWhenEqual()));
         }
         break;
-      case Instruction::BitCast:
-        // If we have (malloc != null), and if the malloc has a single use, we
-        // can assume it is successful and remove the malloc.
-        CallInst* CI = extractMallocCallFromBitCast(LHSI);
-        if (CI && CI->hasOneUse() && LHSI->hasOneUse()
-            && isa<ConstantPointerNull>(RHSC)) {
-          Worklist.Add(LHSI);
-          Worklist.Add(CI);
-          return ReplaceInstUsesWith(I,
-                                     ConstantInt::get(Type::getInt1Ty(*Context),
-                                                      !I.isTrueWhenEqual()));
-        }
-        break;
       }
   }
 
@@ -9536,18 +9523,14 @@
         Align = PrefAlign;
       }
     }
-  } else if (AllocationInst *AI = dyn_cast<AllocationInst>(V)) {
-    // If there is a requested alignment and if this is an alloca, round up.  We
-    // don't do this for malloc, because some systems can't respect the request.
-    if (isa<AllocaInst>(AI)) {
-      if (AI->getAlignment() >= PrefAlign)
-        Align = AI->getAlignment();
-      else {
-        AI->setAlignment(PrefAlign);
-        Align = PrefAlign;
-      }
+  } else if (AllocaInst *AI = dyn_cast<AllocaInst>(V)) {
+    // If there is a requested alignment and if this is an alloca, round up.
+    if (AI->getAlignment() >= PrefAlign)
+      Align = AI->getAlignment();
+    else {
+      AI->setAlignment(PrefAlign);
+      Align = PrefAlign;
     }
-    // No alignment changes are possible for malloc calls
   }
 
   return Align;





More information about the llvm-commits mailing list