Grigory Pastukhov
f66bd8e81a
[LLVM] Add flatten function attribute to LLVM IR and implement recursive inlining in AlwaysInliner ( #174899 )
...
This adds a new function-level `flatten` LLVM IR attribute and
implements support for it in the AlwaysInliner pass, bringing LLVM's
behavior in line with GCC.
Previously, the `flatten` attribute only existed as a Clang attribute,
which was lowered to `alwaysinline` on individual call sites. Per the
RFC discussion [1], the consensus was to match GCC semantics:
recursively inline the entire call tree into the
flattened function, rather than just immediate call sites.
This PR:
- Adds the `flatten` function attribute to LLVM IR
- Implements recursive inlining of all viable callees in AlwaysInliner
- Uses inline history tracking to detect and stop at recursive call
cycles
- Emits optimization remarks when inlining is skipped due to recursion
A follow-up patch will update Clang to emit the LLVM `flatten` attribute
on
functions instead of marking individual call sites with `alwaysinline`.
[1]
https://discourse.llvm.org/t/rfc-function-level-flatten-depth-attribute-for-depth-limited-inlining
2026-03-19 11:25:46 -07:00
..
2026-03-19 11:25:46 -07:00
2026-03-04 12:16:41 +01:00
2026-02-05 07:54:37 -08:00
2026-02-05 07:54:37 -08:00
2025-10-20 07:28:50 -07:00
2026-02-05 07:54:37 -08:00
2026-02-05 07:54:37 -08:00
2026-02-05 07:54:37 -08:00
2026-02-05 07:54:37 -08:00
2026-02-05 07:54:37 -08:00
2026-02-05 07:54:37 -08:00
2026-02-05 07:54:37 -08:00
2026-02-05 07:54:37 -08:00
2026-02-05 07:54:37 -08:00
2026-02-05 07:54:37 -08:00
2025-01-29 16:56:47 +01:00
2026-02-05 07:54:37 -08:00
2026-02-05 07:54:37 -08:00
2026-02-05 07:54:37 -08:00
2025-10-23 20:31:31 +08:00
2024-12-12 12:59:59 +01:00
2024-11-09 16:17:16 +00:00
2026-02-05 07:54:37 -08:00
2026-02-05 07:54:37 -08:00
2026-03-13 09:29:28 +00:00
2026-02-05 07:54:37 -08:00
2025-01-29 16:56:47 +01:00
2026-02-05 07:54:37 -08:00
2025-08-08 11:09:34 +02:00
2025-08-08 11:09:34 +02:00
2025-08-08 11:09:34 +02:00
2026-02-05 07:54:37 -08:00
2026-02-05 07:54:37 -08:00
2026-02-05 07:54:37 -08:00
2026-02-05 07:54:37 -08:00
2025-03-22 10:13:39 -07:00
2026-02-05 07:54:37 -08:00
2024-10-30 11:19:23 -04:00
2026-02-05 07:54:37 -08:00
2025-10-23 20:31:31 +08:00
2025-03-14 15:50:49 +00:00
2025-08-08 11:09:34 +02:00
2025-09-25 13:20:55 +00:00
2025-07-18 14:40:54 -07:00
2025-08-08 11:09:34 +02:00
2026-03-19 11:25:46 -07:00
2026-02-05 07:54:37 -08:00
2026-02-05 07:54:37 -08:00
2024-11-15 14:19:50 +00:00
2026-02-05 07:54:37 -08:00
2026-02-05 07:54:37 -08:00
2026-02-05 07:54:37 -08:00
2026-02-05 07:54:37 -08:00
2026-02-05 07:54:37 -08:00
2026-02-05 07:54:37 -08:00
2026-02-05 07:54:37 -08:00
2026-02-05 07:54:37 -08:00
2026-02-05 07:54:37 -08:00
2025-08-18 17:48:49 +00:00
2026-02-05 07:54:37 -08:00
2026-02-05 07:54:37 -08:00
2026-02-05 07:54:37 -08:00
2026-02-05 07:54:37 -08:00
2024-11-01 09:55:17 -07:00
2026-02-05 07:54:37 -08:00
2026-02-05 07:54:37 -08:00
2026-02-05 07:54:37 -08:00
2026-02-05 07:54:37 -08:00
2024-11-15 14:19:50 +00:00
2026-02-05 07:54:37 -08:00
2026-02-05 07:54:37 -08:00
2025-06-12 09:19:50 +02:00
2025-06-04 11:41:55 +01:00
2025-05-06 11:25:37 +01:00
2026-01-09 13:49:21 -05:00
2025-03-14 15:50:49 +00:00
2025-08-08 11:09:34 +02:00
2026-02-05 07:54:37 -08:00
2025-08-08 11:09:34 +02:00
2026-02-05 07:54:37 -08:00
2026-02-05 07:54:37 -08:00
2026-02-05 07:54:37 -08:00
2026-02-05 07:54:37 -08:00
2025-02-14 09:28:57 +01:00
2025-08-08 11:09:34 +02:00
2025-08-08 11:09:34 +02:00
2026-02-05 07:54:37 -08:00
2025-07-18 21:11:37 -07:00
2025-07-18 21:11:37 -07:00
2025-05-28 16:44:44 -07:00
2026-02-05 07:54:37 -08:00
2025-08-08 11:09:34 +02:00
2025-03-14 15:50:49 +00:00
2025-01-29 16:56:47 +01:00
2025-08-08 11:09:34 +02:00
2025-08-08 11:09:34 +02:00
2025-05-27 15:15:57 +02:00
2025-01-29 16:56:47 +01:00
2026-02-05 07:54:37 -08:00
2026-02-05 07:54:37 -08:00
2025-10-23 20:31:31 +08:00
2025-10-23 20:31:31 +08:00
2025-10-23 20:31:31 +08:00
2025-10-23 20:31:31 +08:00
2026-02-05 07:54:37 -08:00
2026-02-05 07:54:37 -08:00
2026-02-05 07:54:37 -08:00
2024-11-15 14:19:50 +00:00
2025-10-20 08:50:09 +00:00
2024-11-15 14:19:50 +00:00
2026-02-05 07:54:37 -08:00
2024-12-11 16:49:48 +13:00
2026-02-05 07:54:37 -08:00
2025-07-21 15:04:50 +02:00
2026-03-16 22:14:11 +01:00
2026-03-16 22:14:11 +01:00
2025-06-24 14:15:27 +01:00
2026-02-05 07:54:37 -08:00
2026-02-05 07:54:37 -08:00
2026-02-05 07:54:37 -08:00
2026-02-05 07:54:37 -08:00
2026-02-05 07:54:37 -08:00