[llvm-branch-commits] [llvm-branch] r100622 - /llvm/branches/ggreif/CallInst-operands/lib/Transforms/InstCombine/InstCombineCalls.cpp

Gabor Greif ggreif at gmail.com
Wed Apr 7 06:27:40 PDT 2010


Author: ggreif
Date: Wed Apr  7 08:27:39 2010
New Revision: 100622

URL: http://llvm.org/viewvc/llvm-project?rev=100622&view=rev
Log:
tighten types and join two 'if' legs

Modified:
    llvm/branches/ggreif/CallInst-operands/lib/Transforms/InstCombine/InstCombineCalls.cpp

Modified: llvm/branches/ggreif/CallInst-operands/lib/Transforms/InstCombine/InstCombineCalls.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/CallInst-operands/lib/Transforms/InstCombine/InstCombineCalls.cpp?rev=100622&r1=100621&r2=100622&view=diff
==============================================================================
--- llvm/branches/ggreif/CallInst-operands/lib/Transforms/InstCombine/InstCombineCalls.cpp (original)
+++ llvm/branches/ggreif/CallInst-operands/lib/Transforms/InstCombine/InstCombineCalls.cpp Wed Apr  7 08:27:39 2010
@@ -249,7 +249,7 @@
   
   IntrinsicInst *II = dyn_cast<IntrinsicInst>(&CI);
   if (!II) return visitCallSite(&CI);
-  
+
   // Intrinsics cannot occur in an invoke, so handle them here instead of in
   // visitCallSite.
   if (MemIntrinsic *MI = dyn_cast<MemIntrinsic>(II)) {
@@ -273,11 +273,12 @@
     if (MemMoveInst *MMI = dyn_cast<MemMoveInst>(MI)) {
       if (GlobalVariable *GVSrc = dyn_cast<GlobalVariable>(MMI->getSource()))
         if (GVSrc->isConstant()) {
-          Module *M = CI.getParent()->getParent()->getParent();
+          Module *M = MMI->getParent()->getParent()->getParent();
           Intrinsic::ID MemCpyID = Intrinsic::memcpy;
           const Type *Tys[1];
-          Tys[0] = CI.getOperand(2)->getType();
-          CI.setCalledFunction(Intrinsic::getDeclaration(M, MemCpyID, Tys, 1));
+          Tys[0] = MMI->getOperand(2)->getType();
+          MMI->setCalledFunction(Intrinsic::getDeclaration(M, MemCpyID, Tys,
+                                                           1));
           Changed = true;
         }
     }
@@ -286,21 +287,19 @@
       // memmove(x,x,size) -> noop.
       if (MTI->getSource() == MTI->getDest())
         return EraseInstFromFunction(CI);
-    }
 
-    // If we can determine a pointer alignment that is bigger than currently
-    // set, update the alignment.
-    if (isa<MemTransferInst>(MI)) {
-      if (Instruction *I = SimplifyMemTransfer(MI))
+      // If we can determine a pointer alignment that is bigger than currently
+      // set, update the alignment.
+      if (Instruction *I = SimplifyMemTransfer(MTI))
         return I;
     } else if (MemSetInst *MSI = dyn_cast<MemSetInst>(MI)) {
       if (Instruction *I = SimplifyMemSet(MSI))
         return I;
     }
-          
+
     if (Changed) return II;
   }
-  
+
   switch (II->getIntrinsicID()) {
   default: break;
   case Intrinsic::objectsize: {





More information about the llvm-branch-commits mailing list