use ArgOperand accessors

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106697 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Gabor Greif 2010-06-23 23:38:07 +00:00
parent 4b722108e2
commit 71339c965c
2 changed files with 13 additions and 13 deletions

View File

@ -94,7 +94,7 @@ static bool isObjectSmallerThan(const Value *V, unsigned Size,
} else if (const CallInst* CI = extractMallocCall(V)) { } else if (const CallInst* CI = extractMallocCall(V)) {
if (!isArrayMalloc(V, &TD)) if (!isArrayMalloc(V, &TD))
// The size is the argument to the malloc call. // The size is the argument to the malloc call.
if (const ConstantInt* C = dyn_cast<ConstantInt>(CI->getOperand(1))) if (const ConstantInt* C = dyn_cast<ConstantInt>(CI->getArgOperand(0)))
return (C->getZExtValue() < Size); return (C->getZExtValue() < Size);
return false; return false;
} else if (const Argument *A = dyn_cast<Argument>(V)) { } else if (const Argument *A = dyn_cast<Argument>(V)) {
@ -318,10 +318,10 @@ BasicAliasAnalysis::getModRefInfo(CallSite CS, Value *P, unsigned Size) {
case Intrinsic::memcpy: case Intrinsic::memcpy:
case Intrinsic::memmove: { case Intrinsic::memmove: {
unsigned Len = ~0U; unsigned Len = ~0U;
if (ConstantInt *LenCI = dyn_cast<ConstantInt>(II->getOperand(3))) if (ConstantInt *LenCI = dyn_cast<ConstantInt>(II->getArgOperand(2)))
Len = LenCI->getZExtValue(); Len = LenCI->getZExtValue();
Value *Dest = II->getOperand(1); Value *Dest = II->getArgOperand(0);
Value *Src = II->getOperand(2); Value *Src = II->getArgOperand(1);
if (isNoAlias(Dest, Len, P, Size)) { if (isNoAlias(Dest, Len, P, Size)) {
if (isNoAlias(Src, Len, P, Size)) if (isNoAlias(Src, Len, P, Size))
return NoModRef; return NoModRef;
@ -332,9 +332,9 @@ BasicAliasAnalysis::getModRefInfo(CallSite CS, Value *P, unsigned Size) {
case Intrinsic::memset: case Intrinsic::memset:
// Since memset is 'accesses arguments' only, the AliasAnalysis base class // Since memset is 'accesses arguments' only, the AliasAnalysis base class
// will handle it for the variable length case. // will handle it for the variable length case.
if (ConstantInt *LenCI = dyn_cast<ConstantInt>(II->getOperand(3))) { if (ConstantInt *LenCI = dyn_cast<ConstantInt>(II->getArgOperand(2))) {
unsigned Len = LenCI->getZExtValue(); unsigned Len = LenCI->getZExtValue();
Value *Dest = II->getOperand(1); Value *Dest = II->getArgOperand(0);
if (isNoAlias(Dest, Len, P, Size)) if (isNoAlias(Dest, Len, P, Size))
return NoModRef; return NoModRef;
} }
@ -352,7 +352,7 @@ BasicAliasAnalysis::getModRefInfo(CallSite CS, Value *P, unsigned Size) {
case Intrinsic::atomic_load_umax: case Intrinsic::atomic_load_umax:
case Intrinsic::atomic_load_umin: case Intrinsic::atomic_load_umin:
if (TD) { if (TD) {
Value *Op1 = II->getOperand(1); Value *Op1 = II->getArgOperand(0);
unsigned Op1Size = TD->getTypeStoreSize(Op1->getType()); unsigned Op1Size = TD->getTypeStoreSize(Op1->getType());
if (isNoAlias(Op1, Op1Size, P, Size)) if (isNoAlias(Op1, Op1Size, P, Size))
return NoModRef; return NoModRef;
@ -361,14 +361,14 @@ BasicAliasAnalysis::getModRefInfo(CallSite CS, Value *P, unsigned Size) {
case Intrinsic::lifetime_start: case Intrinsic::lifetime_start:
case Intrinsic::lifetime_end: case Intrinsic::lifetime_end:
case Intrinsic::invariant_start: { case Intrinsic::invariant_start: {
unsigned PtrSize = cast<ConstantInt>(II->getOperand(1))->getZExtValue(); unsigned PtrSize = cast<ConstantInt>(II->getArgOperand(0))->getZExtValue();
if (isNoAlias(II->getOperand(2), PtrSize, P, Size)) if (isNoAlias(II->getArgOperand(1), PtrSize, P, Size))
return NoModRef; return NoModRef;
break; break;
} }
case Intrinsic::invariant_end: { case Intrinsic::invariant_end: {
unsigned PtrSize = cast<ConstantInt>(II->getOperand(2))->getZExtValue(); unsigned PtrSize = cast<ConstantInt>(II->getArgOperand(1))->getZExtValue();
if (isNoAlias(II->getOperand(3), PtrSize, P, Size)) if (isNoAlias(II->getArgOperand(2), PtrSize, P, Size))
return NoModRef; return NoModRef;
break; break;
} }

View File

@ -953,7 +953,7 @@ bool llvm::CannotBeNegativeZero(const Value *V, unsigned Depth) {
if (const IntrinsicInst *II = dyn_cast<IntrinsicInst>(I)) if (const IntrinsicInst *II = dyn_cast<IntrinsicInst>(I))
// sqrt(-0.0) = -0.0, no other negative results are possible. // sqrt(-0.0) = -0.0, no other negative results are possible.
if (II->getIntrinsicID() == Intrinsic::sqrt) if (II->getIntrinsicID() == Intrinsic::sqrt)
return CannotBeNegativeZero(II->getOperand(1), Depth+1); return CannotBeNegativeZero(II->getArgOperand(0), Depth+1);
if (const CallInst *CI = dyn_cast<CallInst>(I)) if (const CallInst *CI = dyn_cast<CallInst>(I))
if (const Function *F = CI->getCalledFunction()) { if (const Function *F = CI->getCalledFunction()) {
@ -966,7 +966,7 @@ bool llvm::CannotBeNegativeZero(const Value *V, unsigned Depth) {
if (F->getName() == "fabsl") return true; if (F->getName() == "fabsl") return true;
if (F->getName() == "sqrt" || F->getName() == "sqrtf" || if (F->getName() == "sqrt" || F->getName() == "sqrtf" ||
F->getName() == "sqrtl") F->getName() == "sqrtl")
return CannotBeNegativeZero(CI->getOperand(1), Depth+1); return CannotBeNegativeZero(CI->getArgOperand(0), Depth+1);
} }
} }