Skip to content

[CIR] Upstream support for volatile variables #153280

@andykaylor

Description

@andykaylor

Overview

Upstream support for handling the volatile qualifier on variables and parameters in ClangIR.

The clang AST contains information indicating when volatile handling is required. This task involves updating the existing load and store handling to set the volatile attribute when required.

The existing code has the following placeholders where changes are needed.

assert(!cir::MissingFeatures::opLoadStoreVolatile());
assert(!cir::MissingFeatures::aggValueSlotVolatile());

Additional changes will be required.

Suggested minimal test case

int test_load(volatile int *ptr) {
  return *ptr;
}

void test_store(volatile int *ptr) {
  *ptr = 42;
}

Existing incubator tests

clang/test/CIR/CodeGen/volatile.cpp

Metadata

Metadata

Assignees

Labels

ClangIRAnything related to the ClangIR project

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions