diff options
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r-- | llvm/lib/Analysis/AliasAnalysis.cpp | 7 | ||||
-rw-r--r-- | llvm/lib/Analysis/BasicAliasAnalysis.cpp | 3 |
2 files changed, 6 insertions, 4 deletions
diff --git a/llvm/lib/Analysis/AliasAnalysis.cpp b/llvm/lib/Analysis/AliasAnalysis.cpp index b6a65e10a89..10b3ed91659 100644 --- a/llvm/lib/Analysis/AliasAnalysis.cpp +++ b/llvm/lib/Analysis/AliasAnalysis.cpp @@ -460,7 +460,8 @@ ModRefInfo AAResults::callCapturesBefore(const Instruction *I, // 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 @@ -469,9 +470,9 @@ ModRefInfo AAResults::callCapturesBefore(const Instruction *I, // 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; } diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp index e79092b0acd..55498432e11 100644 --- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp +++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp @@ -740,7 +740,8 @@ ModRefInfo BasicAAResult::getModRefInfo(ImmutableCallSite CS, // 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 |