Files
llvm-project/llvm/test/Bitcode/memory-attribute-upgrade.ll
CarolineConcatto d96722b660 [LLVM] Improve IR parsing and printing for target memory locations (#176968)
This patch adds support for specifying all target memory locations using
a
single IR spellings such as:
```
memory(target_mem: read)
```

This form is not supported in TableGen, but it is now accepted by the IR
parser.
When the parser encounters target_mem, it expands it to all
target-memory
locations (e.g., target_mem0, target_mem1, …).

Printing behavior

When all target-memory locations share the same ModRef value, the
printer
now collapses them into a single entry:
```
memory(target_mem: read)
```
Otherwise, each target memory location is printed separately.

Rejected IR:
```
memory(target_mem0: write, target_mem: read)
```
This is invalid because the default access kind for the target memory
group
must appear first.
2026-03-19 17:29:54 +00:00

8 lines
374 B
LLVM

; RUN: llvm-dis < %S/Inputs/memory-attribute-upgrade.bc | FileCheck %s
; CHECK: ; Function Attrs: memory(write, argmem: read, target_mem: none)
; CHECK-NEXT: define void @test_any_write_argmem_read(ptr %p)
; CHECK: ; Function Attrs: memory(read, argmem: readwrite, inaccessiblemem: none, target_mem: none)
; CHECK-NEXT: define void @test_any_read_argmem_readwrite(ptr %p)