diff options
author | Nikita Popov <npopov@redhat.com> | 2025-10-01 08:58:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-10-01 08:58:47 +0200 |
commit | 63ca8483d0efc544c5b8c4484d36a64c3b3ff210 (patch) | |
tree | 3ed5129ab1052730da9d6aeb43836b9527ca759f /clang/test/CodeGen/PowerPC/toc-data-structs-arrays.cpp | |
parent | d62776d03323e709abb8e4734e0ae36f76dba815 (diff) | |
download | llvm-63ca8483d0efc544c5b8c4484d36a64c3b3ff210.zip llvm-63ca8483d0efc544c5b8c4484d36a64c3b3ff210.tar.gz llvm-63ca8483d0efc544c5b8c4484d36a64c3b3ff210.tar.bz2 |
[IR] Introduce !captures metadata (#160913)
This introduces `!captures` metadata on stores, which looks like this:
```
store ptr %x, ptr %y, !captures !{!"address", !"read_provenance"}
```
The semantics are the same as replacing the store with a call like this:
```
call void @llvm.store(ptr captures(address, read_provenance) %x, ptr %y)
```
This metadata is intended for annotation by frontends -- it's not
something we can feasibly infer at this point, as it would require
analyzing uses of the pointer stored in memory.
The motivating use case for this is Rust's `println!()` machinery, which
involves storing a reference to the value inside a structure. This means
that printing code (including conditional debugging code), can inhibit
optimizations because the pointer escapes. With the new metadata we can
annotate this as a read-only capture, which has less impact on
optimizations.
Diffstat (limited to 'clang/test/CodeGen/PowerPC/toc-data-structs-arrays.cpp')
0 files changed, 0 insertions, 0 deletions