]> granicus.if.org Git - llvm/commitdiff
Fix argument attribute queries with bundle operands
authorHal Finkel <hfinkel@anl.gov>
Thu, 15 Dec 2016 05:09:15 +0000 (05:09 +0000)
committerHal Finkel <hfinkel@anl.gov>
Thu, 15 Dec 2016 05:09:15 +0000 (05:09 +0000)
When iterating over data operands in AA, don't make argument-attribute-specific
queries on bundle operands. Trying to fix self hosting...

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289765 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/AliasAnalysis.cpp
lib/Analysis/BasicAliasAnalysis.cpp

index b6a65e10a89dff2b25a61119df35ca376eab435b..10b3ed91659f505a0d2aefd6e8f9d91e923d4a5b 100644 (file)
@@ -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;
     }
index e79092b0acdf10844c145d40fadf4e050d9f5761..55498432e119ed2f54e2f7be0e2f182fadc54279 100644 (file)
@@ -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