[PATCH] D124514: [ArgPromotion] Allow pointer promotion if byval adds to many arguments

Pavel Samolysov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 27 02:58:45 PDT 2022


psamolysov created this revision.
psamolysov added reviewers: aeubanks, jdoerfert, nikic.
psamolysov added a project: LLVM.
Herald added subscribers: ormris, hiraditya.
Herald added a project: All.
psamolysov requested review of this revision.
Herald added a subscriber: llvm-commits.

The ArgPromotion pass checks whether a passed byval structure has more
than 'MaxElements' elements and if it has, disables the promotion of the
argument at all even though the promotion can be safe and possible when
not all the structure's elements are actually used in the function.

The patch removes the immediate skipping the argument if passing
structure elements is safe but there are too many elements and gives
the argument a chance to be promoted 'as usual', so without taking
'byval' attribute into account.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D124514

Files:
  llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
  llvm/test/Transforms/ArgumentPromotion/byval-through-pointer-promotion.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124514.425455.patch
Type: text/x-patch
Size: 4855 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220427/743a81bb/attachment.bin>


More information about the llvm-commits mailing list