use getArgOperand (corrected by CallInst::ArgOffset) instead of getOperand

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107275 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Gabor Greif
2010-06-30 12:38:26 +00:00
parent 6e1f330c4c
commit 2458513430

View File

@@ -772,13 +772,13 @@ protected:
NewInstruction = IC->ReplaceInstUsesWith(*CI, With); NewInstruction = IC->ReplaceInstUsesWith(*CI, With);
} }
bool isFoldable(unsigned SizeCIOp, unsigned SizeArgOp, bool isString) const { bool isFoldable(unsigned SizeCIOp, unsigned SizeArgOp, bool isString) const {
if (ConstantInt *SizeCI = dyn_cast<ConstantInt>(CI->getOperand(SizeCIOp))) { if (ConstantInt *SizeCI = dyn_cast<ConstantInt>(CI->getArgOperand(SizeCIOp - CallInst::ArgOffset))) {
if (SizeCI->isAllOnesValue()) if (SizeCI->isAllOnesValue())
return true; return true;
if (isString) if (isString)
return SizeCI->getZExtValue() >= return SizeCI->getZExtValue() >=
GetStringLength(CI->getOperand(SizeArgOp)); GetStringLength(CI->getArgOperand(SizeArgOp - CallInst::ArgOffset));
if (ConstantInt *Arg = dyn_cast<ConstantInt>(CI->getOperand(SizeArgOp))) if (ConstantInt *Arg = dyn_cast<ConstantInt>(CI->getArgOperand(SizeArgOp - CallInst::ArgOffset)))
return SizeCI->getZExtValue() >= Arg->getZExtValue(); return SizeCI->getZExtValue() >= Arg->getZExtValue();
} }
return false; return false;