[PATCH] D109335: [InstCombine] Make check for sret in a vararg function clearer

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 6 13:05:56 PDT 2021


aeubanks created this revision.
aeubanks added a reviewer: rnk.
Herald added a subscriber: hiraditya.
aeubanks requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D109335

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


Index: llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
===================================================================
--- llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
+++ llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
@@ -2884,7 +2884,7 @@
     // 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;
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109335.370965.patch
Type: text/x-patch
Size: 559 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210906/f426fd1f/attachment.bin>


More information about the llvm-commits mailing list