[clang] [CIR] Upstream handling for __builtin_prefetch (PR #164387)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 21 13:09:36 PDT 2025


================
@@ -4049,6 +4049,39 @@ def CIR_ExpectOp : CIR_Op<"expect", [
   }];
 }
 
+//===----------------------------------------------------------------------===//
+// PrefetchOp
+//===----------------------------------------------------------------------===//
+
+def CIR_PrefetchOp : CIR_Op<"prefetch"> {
+  let summary = "prefetch operation";
+  let description = [{
+    The `cir.prefetch` op prefetches data from the memmory address.
----------------
andykaylor wrote:

```suggestion
    The `cir.prefetch` operation is a hint to the code generator to insert a
    prefetch instruction if supported; otherwise, it is a noop. Prefetches
    have no effect on the behavior of the program but can change its
    performance characteristics.
```
This is copied from the LLVM language reference description of the `llvm.prefetch` intrinsic. It provides a bit more clarity.

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


More information about the cfe-commits mailing list