forked from OSchip/llvm-project
use getArgOperand (corrected by CallInst::ArgOffset) instead of getOperand
llvm-svn: 107275
This commit is contained in:
parent
639ffb0c07
commit
3abd881bea
|
@ -772,13 +772,13 @@ protected:
|
|||
NewInstruction = IC->ReplaceInstUsesWith(*CI, With);
|
||||
}
|
||||
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())
|
||||
return true;
|
||||
if (isString)
|
||||
return SizeCI->getZExtValue() >=
|
||||
GetStringLength(CI->getOperand(SizeArgOp));
|
||||
if (ConstantInt *Arg = dyn_cast<ConstantInt>(CI->getOperand(SizeArgOp)))
|
||||
GetStringLength(CI->getArgOperand(SizeArgOp - CallInst::ArgOffset));
|
||||
if (ConstantInt *Arg = dyn_cast<ConstantInt>(CI->getArgOperand(SizeArgOp - CallInst::ArgOffset)))
|
||||
return SizeCI->getZExtValue() >= Arg->getZExtValue();
|
||||
}
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue