]> granicus.if.org Git - llvm/commitdiff
[Attributor][FIX] Lookup of (call site) argument attributes
authorJohannes Doerfert <jdoerfert@anl.gov>
Sat, 13 Jul 2019 00:09:27 +0000 (00:09 +0000)
committerJohannes Doerfert <jdoerfert@anl.gov>
Sat, 13 Jul 2019 00:09:27 +0000 (00:09 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@365977 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Transforms/IPO/Attributor.h

index 3a8e88bd20ff54c25eaee367fcd4b4a2308b7740..0b72394e8e9ec055d557857a089210ca4d026564 100644 (file)
@@ -179,9 +179,12 @@ struct Attributor {
     assert(AAType::ID != Attribute::None &&
            "Cannot lookup generic abstract attributes!");
 
-    // Determine the argument number automatically for llvm::Arguments.
+    // Determine the argument number automatically for llvm::Arguments if none
+    // is set. Do not override a given one as it could be a use of the argument
+    // in a call site.
     if (auto *Arg = dyn_cast<Argument>(&V))
-      ArgNo = Arg->getArgNo();
+      if (ArgNo == -1)
+        ArgNo = Arg->getArgNo();
 
     // If a function was given together with an argument number, perform the
     // lookup for the actual argument instead. Don't do it for variadic