[ArgPromotion] Change the condition to check the promotion limit
authorPavel Samolysov <samolisov@gmail.com>
Thu, 28 Apr 2022 16:37:35 +0000 (09:37 -0700)
committerArthur Eubanks <aeubanks@google.com>
Thu, 28 Apr 2022 16:42:58 +0000 (09:42 -0700)
commit6b825e50f7f41f40cb473587bfe65bcb0069da47
treee25fbad6fdd9e136ed22998fe6f18822501433c8
parent3a39bb96ca812d1cbd027803112e94f701ad8687
[ArgPromotion] Change the condition to check the promotion limit

The condition should be 'ArgParts.size() > MaxElements', so that if we
have exactly 3 elements in the 'ArgParts' vector, the promotion should
be allowed because the 'MaxElement' threshold is not exceeded yet.

The default value for 'MaxElement' has been decreased to 2 in order
to avoid an actual change in argument promoting behavior. However,
this changes byval argument transformation behavior by allowing
adding not more than 2 arguments to the function instead of 3 allowed
before.

Reviewed By: aeubanks

Differential Revision: https://reviews.llvm.org/D124178
llvm/include/llvm/Transforms/IPO/ArgumentPromotion.h
llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
llvm/test/Transforms/ArgumentPromotion/max-elements-limit.ll [new file with mode: 0644]