[llvm] b81fc14 - [NFC][InstCombine] Make check for sret in a vararg function clearer

Arthur Eubanks via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 7 11:22:31 PDT 2021


Author: Arthur Eubanks
Date: 2021-09-07T11:19:27-07:00
New Revision: b81fc14f2da1800432e864c27abb01c1a219a97e

URL: https://github.com/llvm/llvm-project/commit/b81fc14f2da1800432e864c27abb01c1a219a97e
DIFF: https://github.com/llvm/llvm-project/commit/b81fc14f2da1800432e864c27abb01c1a219a97e.diff

LOG: [NFC][InstCombine] Make check for sret in a vararg function clearer

We're trying to get the parameter index of sret and see if it's part of
a function's varargs.

Reviewed By: rnk

Differential Revision: https://reviews.llvm.org/D109335

Added: 
    

Modified: 
    llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
index a05fe7a95103..c3fc5ea0ad75 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
@@ -2884,7 +2884,7 @@ bool InstCombinerImpl::transformConstExprCastCall(CallBase &Call) {
     // that are compatible with being a vararg call argument.
     unsigned SRetIdx;
     if (CallerPAL.hasAttrSomewhere(Attribute::StructRet, &SRetIdx) &&
-        SRetIdx > FT->getNumParams())
+        SRetIdx - AttributeList::FirstArgIndex >= FT->getNumParams())
       return false;
   }
 


        


More information about the llvm-commits mailing list