// pointer were passed to arguments that were neither of these, then it
// couldn't be no-capture.
if (!(*CI)->getType()->isPointerTy() ||
- (!CS.doesNotCapture(ArgNo) && !CS.isByValArgument(ArgNo)))
+ (!CS.doesNotCapture(ArgNo) &&
+ ArgNo < CS.getNumArgOperands() && !CS.isByValArgument(ArgNo)))
continue;
// If this is a no-capture pointer argument, see if we can tell that it
// escape.
if (isNoAlias(MemoryLocation(*CI), MemoryLocation(Object)))
continue;
- if (CS.doesNotAccessMemory(ArgNo))
+ if (ArgNo < CS.getNumArgOperands() && CS.doesNotAccessMemory(ArgNo))
continue;
- if (CS.onlyReadsMemory(ArgNo)) {
+ if (ArgNo < CS.getNumArgOperands() && CS.onlyReadsMemory(ArgNo)) {
R = MRI_Ref;
continue;
}
// pointer were passed to arguments that were neither of these, then it
// couldn't be no-capture.
if (!(*CI)->getType()->isPointerTy() ||
- (!CS.doesNotCapture(OperandNo) && !CS.isByValArgument(OperandNo)))
+ (!CS.doesNotCapture(OperandNo) &&
+ OperandNo < CS.getNumArgOperands() && !CS.isByValArgument(OperandNo)))
continue;
// If this is a no-capture pointer argument, see if we can tell that it