# RFC: Code Prefetch Insertion

**URL:** <https://discourse.llvm.org/t/rfc-code-prefetch-insertion/88668>\
**Category:** LLVM Project\
**Tags:** pgo\
**Created:** [October 22, 2025, 9:02pm UTC](https://discourse.llvm.org/t/rfc-code-prefetch-insertion/88668 "2025-10-22T21:02:24Z")\
**Posts on this page:** 1\
**Showing post:** 22

<div class="post-metadata">

**Author:** ![rlavaee](https://sea1.discourse-cdn.com/flex021/user_avatar/discourse.llvm.org/rlavaee/32/24785_2.png) [@rlavaee](https://discourse.llvm.org/u/rlavaee)\
**Post date:** [November 8, 2025, 12:51am UTC](https://discourse.llvm.org/t/rfc-code-prefetch-insertion/88668/22 "2025-11-08T00:51:42Z")

</div>

> [@QuqqU](#):
>
> I was wondering why the L1i performance decreased. It seems a bit counter-intuitive. Does the prefetchi\* instruction load the target code into L2, rather than L1i? I couldn’t find a precise spec in the official document.

> [@WenleiHe](#):
>
> Thanks for sharing the data. Any insights on the L1 icache miss increase?

Correct. The prefetchi\* instruction targets the L2 cache. It’s not documented, but it’s not hard to verify with microbenchmarks. The increase in L1 icache is not from those instructions per se as it’s not reproducible when they are replaced by the same size nops. We believe it’s due to evictions from the L2 which subsequently cause evictions in the L1 icache (due to cache inclusivity).

---

_[View the full topic](https://discourse.llvm.org/t/rfc-code-prefetch-insertion/88668)._
