[ArgumentPromotion] Bail if any callers are minsize
authorArthur Eubanks <aeubanks@google.com>
Wed, 3 May 2023 16:56:22 +0000 (09:56 -0700)
committerArthur Eubanks <aeubanks@google.com>
Wed, 3 May 2023 18:29:15 +0000 (11:29 -0700)
commit8b8466fd31e5a194fd8ba7a73a0f23d32f164318
treef698299b270f9f26d566d38bac95ebd0b0459b27
parent7e6a15892a16b95ead395956a910d020772fdd16
[ArgumentPromotion] Bail if any callers are minsize

Argument promotion mostly works on functions with more than one caller (otherwise the function would be inlined or is dead), so there's a good chance that performing this increases code size since we introduce loads at every call site. If any caller is marked minsize, bail.

We could compare the number of loads/stores removed from the function with the number of loads introduced in callers, but that's TODO.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D149768
llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
llvm/test/Transforms/ArgumentPromotion/minsize.ll [new file with mode: 0644]