[clang] [llvm] [Inliner] Propagate more attributes to params when inlining (PR #91101)

Nikita Popov via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 5 13:26:50 PDT 2024


nikic wrote:

High level question: Are all of these really useful?

For parameter attributes, there are really two types, ones that are used to reason about calls, and ones used to reason about function definitions. I think the split here is something like:

 * readonly/readnone: Mostly used for calls. Since recently used for definitions in conjunction with noalias.
 * writeonly: Used for calls.
 * range, dereferenceable_or_null: Used for definitions.
 * align: Mostly used for definitions, but also used for intrinsic calls.
 * nonnull, dereferenceable: Mostly used for definitions. Used for calls in conjunction with noundef for "dominating conditions" in isKnownNonZero.

Based on that breakdown, I can see some usefulness for propagating the readonly family, align and nonnull/dereferenceable.

Is there anything that propagating range and dereferenceof_or_null is good for? I haven't checked how the latter is used in detail, but I'm pretty confident that we don't use call-site parameter range information for anything.

https://github.com/llvm/llvm-project/pull/91101


More information about the cfe-commits mailing list