[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp

Chris Lattner lattner at cs.uiuc.edu
Sun Jul 18 11:59:54 PDT 2004



Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.224 -> 1.225

---
Log message:

Minor cleanup, no functionality change


---
Diffs of the changes:  (+2 -7)

Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.224 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.225
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.224	Sun Jul 18 03:32:43 2004
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp	Sun Jul 18 13:59:44 2004
@@ -2456,10 +2456,8 @@
 bool InstCombiner::transformConstExprCastCall(CallSite CS) {
   if (!isa<ConstantExpr>(CS.getCalledValue())) return false;
   ConstantExpr *CE = cast<ConstantExpr>(CS.getCalledValue());
-  if (CE->getOpcode() != Instruction::Cast ||
-      !isa<GlobalValue>(CE->getOperand(0)))
+  if (CE->getOpcode() != Instruction::Cast || !isa<Function>(CE->getOperand(0)))
     return false;
-  if (!isa<Function>(CE->getOperand(0))) return false;
   Function *Callee = cast<Function>(CE->getOperand(0));
   Instruction *Caller = CS.getInstruction();
 
@@ -2809,8 +2807,7 @@
       Indices.push_back(cast<Constant>(*I));
 
     if (I == E) {  // If they are all constants...
-      Constant *CE =
-        ConstantExpr::getGetElementPtr(GV, Indices);
+      Constant *CE = ConstantExpr::getGetElementPtr(GV, Indices);
 
       // Replace all uses of the GEP with the new constexpr...
       return ReplaceInstUsesWith(GEP, CE);
@@ -2977,8 +2974,6 @@
   if (Constant *C = dyn_cast<Constant>(Op))
     if (C->isNullValue())  // load null -> 0
       return ReplaceInstUsesWith(LI, Constant::getNullValue(LI.getType()));
-    else if (isa<GlobalValue>(C))
-      Op = C;
 
   // Instcombine load (constant global) into the value loaded...
   if (GlobalVariable *GV = dyn_cast<GlobalVariable>(Op))





More information about the llvm-commits mailing list