3 Commits

Author SHA1 Message Date
Rahman Lavaee
4aa1f211ca
Centralize prefetch target storage in MachineFunction. (#184194)
### Prefetch Symbol Resolution

Based on this
[suggestion](https://discourse.llvm.org/t/rfc-code-prefetch-insertion/88668/29?u=rlavaee),
we must identify if a prefetch target is defined in the current module
to avoid **undefined symbol errors**. Since this occurs during
sequential **CodeGen**, we must rely on function names rather than IR
Module APIs.

**Key Changes:**
* **`MachineFunction` Integration:** Added a `PrefetchTargets` field
(with serialization) to track all targets associated with a function.
* **Guaranteed Emission:** All prefetch targets are now emitted
regardless of basic block or callsite index matches to ensure the symbol
exists.
* **Fallback Placement:** Targets with non-matching callsite indices are
emitted at the end of the block to resolve the reference.
2026-03-09 12:15:38 -07:00
Rahul Joshi
b12e3122c8
[NFC][Core][CodeGen] Remove pass initialization from pass constructors (#180153) 2026-02-06 09:05:47 -08:00
Rahman Lavaee
ba6c5f8e4e
Insert symbols for prefetch targets read from basic blocks section profile. (#168439)
This is the first PR to enable the prefetch optimization via Propeller
based on our
[RFC](https://discourse.llvm.org/t/rfc-code-prefetch-insertion/88668/22).
It enables emitting special symbols prefixed with
`__llvm_prefetch_target` to point to the prefetch targets as specified
via directives in the profile. A prefetch target is uniquely identified
by its function name, basic block ID, and the subblock index (used when
the target is after a call instruction).

A new pass is added which sets a field in basic blocks which have
prefetch targets. The next PR will add the prefetch insertion logic into
the same pass.
2026-01-05 15:36:59 -08:00