[llvm-branch-commits] [llvm-branch] r100425 - /llvm/branches/ggreif/CallInst-operands/lib/Transforms/IPO/GlobalOpt.cpp
Gabor Greif
ggreif at gmail.com
Mon Apr 5 05:06:15 PDT 2010
Author: ggreif
Date: Mon Apr 5 07:06:14 2010
New Revision: 100425
URL: http://llvm.org/viewvc/llvm-project?rev=100425&view=rev
Log:
shift some more operands
Modified:
llvm/branches/ggreif/CallInst-operands/lib/Transforms/IPO/GlobalOpt.cpp
Modified: llvm/branches/ggreif/CallInst-operands/lib/Transforms/IPO/GlobalOpt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/CallInst-operands/lib/Transforms/IPO/GlobalOpt.cpp?rev=100425&r1=100424&r2=100425&view=diff
==============================================================================
--- llvm/branches/ggreif/CallInst-operands/lib/Transforms/IPO/GlobalOpt.cpp (original)
+++ llvm/branches/ggreif/CallInst-operands/lib/Transforms/IPO/GlobalOpt.cpp Mon Apr 5 07:06:14 2010
@@ -1309,8 +1309,8 @@
// if (F2) { free(F2); F2 = 0; }
// }
// The malloc can also fail if its argument is too large.
- Constant *ConstantZero = ConstantInt::get(CI->getOperand(1)->getType(), 0);
- Value *RunningOr = new ICmpInst(CI, ICmpInst::ICMP_SLT, CI->getOperand(1),
+ Constant *ConstantZero = ConstantInt::get(CI->getOperand(0)->getType(), 0);
+ Value *RunningOr = new ICmpInst(CI, ICmpInst::ICMP_SLT, CI->getOperand(0),
ConstantZero, "isneg");
for (unsigned i = 0, e = FieldMallocs.size(); i != e; ++i) {
Value *Cond = new ICmpInst(CI, ICmpInst::ICMP_EQ, FieldMallocs[i],
@@ -1494,7 +1494,7 @@
// If this is an allocation of a fixed size array of structs, analyze as a
// variable size array. malloc [100 x struct],1 -> malloc struct, 100
- if (NElems == ConstantInt::get(CI->getOperand(1)->getType(), 1))
+ if (NElems == ConstantInt::get(CI->getOperand(0)->getType(), 1))
if (const ArrayType *AT = dyn_cast<ArrayType>(AllocTy))
AllocTy = AT->getElementType();
@@ -2245,8 +2245,8 @@
} else if (SelectInst *SI = dyn_cast<SelectInst>(CurInst)) {
InstResult =
ConstantExpr::getSelect(getVal(Values, SI->getOperand(0)),
- getVal(Values, SI->getOperand(1)),
- getVal(Values, SI->getOperand(2)));
+ getVal(Values, SI->getOperand(1)),
+ getVal(Values, SI->getOperand(2)));
} else if (GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(CurInst)) {
Constant *P = getVal(Values, GEP->getOperand(0));
SmallVector<Constant*, 8> GEPOps;
@@ -2278,10 +2278,10 @@
}
// Cannot handle inline asm.
- if (isa<InlineAsm>(CI->getOperand(0))) return false;
+ if (isa<InlineAsm>(CI->getCalledValue())) return false;
// Resolve function pointers.
- Function *Callee = dyn_cast<Function>(getVal(Values, CI->getOperand(0)));
+ Function *Callee = dyn_cast<Function>(getVal(Values, CI->getCalledValue()));
if (!Callee) return false; // Cannot resolve.
SmallVector<Constant*, 8> Formals;
More information about the llvm-branch-commits
mailing list