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.
31 lines
960 B
LLVM
31 lines
960 B
LLVM
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes
|
|
; RUN: opt -S -passes=function-attrs < %s | FileCheck %s
|
|
|
|
@i = global i32 0
|
|
|
|
define void @foo() {
|
|
; CHECK: Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none, target_mem: none)
|
|
; CHECK-LABEL: define {{[^@]+}}@foo
|
|
; CHECK-SAME: () #[[ATTR0:[0-9]+]] {
|
|
; CHECK-NEXT: store i32 1, ptr @i, align 4
|
|
; CHECK-NEXT: call void @bar()
|
|
; CHECK-NEXT: ret void
|
|
;
|
|
store i32 1, ptr @i
|
|
call void @bar()
|
|
ret void
|
|
}
|
|
|
|
define void @bar() {
|
|
; CHECK: Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none, target_mem: none)
|
|
; CHECK-LABEL: define {{[^@]+}}@bar
|
|
; CHECK-SAME: () #[[ATTR0]] {
|
|
; CHECK-NEXT: [[I:%.*]] = load i32, ptr @i, align 4
|
|
; CHECK-NEXT: call void @foo()
|
|
; CHECK-NEXT: ret void
|
|
;
|
|
%i = load i32, ptr @i
|
|
call void @foo()
|
|
ret void
|
|
}
|