Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CIR] add a new volatile flag to distinguish volatile accesses #402

Merged
merged 4 commits into from
Jan 31, 2024

Conversation

Lancern
Copy link
Member

@Lancern Lancern commented Jan 16, 2024

This patch adds a new volatile tag to the following operations to distinguish volatile loads and stores from normal loads and stores:

  • cir.load
  • cir.store
  • cir.get_bitfield
  • cir.set_bitfield

Besides, this patch also updates the CodeGen and LLVMIR lowering code to start emitting CIR and LLVMIR operations with volatile flag.

Copy link
Member

@bcardosolopes bcardosolopes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding volatile support. Only few nit comments but overall great

@@ -5,7 +5,7 @@
module {
cir.func @foo(%arg0: !s32i) {
%0 = cir.alloca !s32i, cir.ptr <!s32i>, %arg0 : !s32i, ["tmp"] {alignment = 16 : i64}
cir.return
cir.return
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated to this PR

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

// CHECK-NEXT: cir.store %arg0, %0 : !cir.ptr<!ty_22Foo22>, cir.ptr <!cir.ptr<!ty_22Foo22>>
// CHECK-NEXT: %2 = cir.load %0 : cir.ptr <!cir.ptr<!ty_22Foo22>>, !cir.ptr<!ty_22Foo22>
// CHECK-NEXT: %3 = cir.get_member %2[0] {name = "x"} : !cir.ptr<!ty_22Foo22> -> !cir.ptr<!s32i>
// CHECK-NEXT: %4 = cir.load volatile %3 : cir.ptr <!s32i>, !s32i
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the testcases. Since the overall features are already tested elsewhere, you can probably just check the relevant bits here. Example:

//      CHECK: cir.func @_Z16test_load_field1PV3Foo
//      CHECK: cir.load volatile
//      CHECK-NOT: cir.store volatile

If you prefere a more complete testcase, please then add regexes for the values, example:

//      CHECK: cir.func @_Z16test_load_field1PV3Foo
//      CHECK: %[[MemberAddr:.*]] = cir.get_member
//      CHECK: cir.load volatile %[[MemberAddr]]

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

clang/include/clang/CIR/Dialect/IR/CIROps.td Show resolved Hide resolved
@lanza lanza force-pushed the main branch 2 times, most recently from 4e069c6 to 79d4dc7 Compare January 29, 2024 23:34
@bcardosolopes
Copy link
Member

@lanza just rebased and this has the side effect of breaking GH PR workflow, making it impossible to review, apologies. Please rebase!

This patch adds a new `volatile` tag to the following operations to distinguish
volatile loads and stores from normal loads and stores:

- `cir.load`
- `cir.store`
- `cir.get_bitfield`
- `cir.set_bitfield`

Besides, this patch also updates the CodeGen and LLVMIR lowering code to start
emitting CIR and LLVMIR operations with volatile flag.
@Lancern Lancern force-pushed the volatile-load-store branch from 7562501 to 422ed96 Compare January 30, 2024 14:39
@Lancern
Copy link
Member Author

Lancern commented Jan 30, 2024

Please rebase!

@bcardosolopes Rebased.

Copy link
Member

@bcardosolopes bcardosolopes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bcardosolopes
Copy link
Member

The buildbot failure seems unrelated

@bcardosolopes bcardosolopes merged commit afb7c68 into llvm:main Jan 31, 2024
5 of 6 checks passed
@Lancern Lancern deleted the volatile-load-store branch February 2, 2024 13:28
lanza pushed a commit that referenced this pull request Mar 23, 2024
This patch adds a new `volatile` tag to the following operations to
distinguish volatile loads and stores from normal loads and stores:

- `cir.load`
- `cir.store`
- `cir.get_bitfield`
- `cir.set_bitfield`

Besides, this patch also updates the CodeGen and LLVMIR lowering code to
start emitting CIR and LLVMIR operations with volatile flag.
eZWALT pushed a commit to eZWALT/clangir that referenced this pull request Mar 24, 2024
)

This patch adds a new `volatile` tag to the following operations to
distinguish volatile loads and stores from normal loads and stores:

- `cir.load`
- `cir.store`
- `cir.get_bitfield`
- `cir.set_bitfield`

Besides, this patch also updates the CodeGen and LLVMIR lowering code to
start emitting CIR and LLVMIR operations with volatile flag.
lanza pushed a commit that referenced this pull request Apr 29, 2024
This patch adds a new `volatile` tag to the following operations to
distinguish volatile loads and stores from normal loads and stores:

- `cir.load`
- `cir.store`
- `cir.get_bitfield`
- `cir.set_bitfield`

Besides, this patch also updates the CodeGen and LLVMIR lowering code to
start emitting CIR and LLVMIR operations with volatile flag.
lanza pushed a commit that referenced this pull request Apr 29, 2024
This patch adds a new `volatile` tag to the following operations to
distinguish volatile loads and stores from normal loads and stores:

- `cir.load`
- `cir.store`
- `cir.get_bitfield`
- `cir.set_bitfield`

Besides, this patch also updates the CodeGen and LLVMIR lowering code to
start emitting CIR and LLVMIR operations with volatile flag.
eZWALT pushed a commit to eZWALT/clangir that referenced this pull request Apr 29, 2024
)

This patch adds a new `volatile` tag to the following operations to
distinguish volatile loads and stores from normal loads and stores:

- `cir.load`
- `cir.store`
- `cir.get_bitfield`
- `cir.set_bitfield`

Besides, this patch also updates the CodeGen and LLVMIR lowering code to
start emitting CIR and LLVMIR operations with volatile flag.
lanza pushed a commit that referenced this pull request Apr 29, 2024
This patch adds a new `volatile` tag to the following operations to
distinguish volatile loads and stores from normal loads and stores:

- `cir.load`
- `cir.store`
- `cir.get_bitfield`
- `cir.set_bitfield`

Besides, this patch also updates the CodeGen and LLVMIR lowering code to
start emitting CIR and LLVMIR operations with volatile flag.
bruteforceboy pushed a commit to bruteforceboy/clangir that referenced this pull request Oct 2, 2024
)

This patch adds a new `volatile` tag to the following operations to
distinguish volatile loads and stores from normal loads and stores:

- `cir.load`
- `cir.store`
- `cir.get_bitfield`
- `cir.set_bitfield`

Besides, this patch also updates the CodeGen and LLVMIR lowering code to
start emitting CIR and LLVMIR operations with volatile flag.
Hugobros3 pushed a commit to shady-gang/clangir that referenced this pull request Oct 2, 2024
)

This patch adds a new `volatile` tag to the following operations to
distinguish volatile loads and stores from normal loads and stores:

- `cir.load`
- `cir.store`
- `cir.get_bitfield`
- `cir.set_bitfield`

Besides, this patch also updates the CodeGen and LLVMIR lowering code to
start emitting CIR and LLVMIR operations with volatile flag.
keryell pushed a commit to keryell/clangir that referenced this pull request Oct 19, 2024
)

This patch adds a new `volatile` tag to the following operations to
distinguish volatile loads and stores from normal loads and stores:

- `cir.load`
- `cir.store`
- `cir.get_bitfield`
- `cir.set_bitfield`

Besides, this patch also updates the CodeGen and LLVMIR lowering code to
start emitting CIR and LLVMIR operations with volatile flag.
lanza pushed a commit that referenced this pull request Nov 5, 2024
This patch adds a new `volatile` tag to the following operations to
distinguish volatile loads and stores from normal loads and stores:

- `cir.load`
- `cir.store`
- `cir.get_bitfield`
- `cir.set_bitfield`

Besides, this patch also updates the CodeGen and LLVMIR lowering code to
start emitting CIR and LLVMIR operations with volatile flag.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants