[PATCH] D135738: [InstCombine] Bail out of casting calls when a conversion to byval is involved.

Mike Hommey via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 11 18:39:36 PDT 2022


glandium created this revision.
glandium added a reviewer: nikic.
Herald added a subscriber: hiraditya.
Herald added a project: All.
glandium requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Fixes #58307


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D135738

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
@@ -3395,6 +3395,10 @@
     if (CallerPAL.hasParamAttr(i, Attribute::SwiftError))
       return false;
 
+    if (!CallerPAL.hasParamAttr(i, Attribute::ByVal) &&
+        Callee->getAttributes().hasParamAttr(i, Attribute::ByVal))
+      return false; // Cannot transform to byval.
+
     // If the parameter is passed as a byval argument, then we have to have a
     // sized type and the sized type has to have the same size as the old type.
     if (ParamTy != ActTy && CallerPAL.hasParamAttr(i, Attribute::ByVal)) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D135738.466993.patch
Type: text/x-patch
Size: 761 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221012/d666f0b2/attachment.bin>


More information about the llvm-commits mailing list