Fix argument attribute queries with bundle operands
When iterating over data operands in AA, don't make argument-attribute-specific
queries on bundle operands. Trying to fix self hosting...
llvm-svn: 289765
diff --git a/llvm/lib/Analysis/AliasAnalysis.cpp b/llvm/lib/Analysis/AliasAnalysis.cpp
index b6a65e1..10b3ed9 100644
--- a/llvm/lib/Analysis/AliasAnalysis.cpp
+++ b/llvm/lib/Analysis/AliasAnalysis.cpp
@@ -460,7 +460,8 @@
// 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 @@
// 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;
}