diff --git a/test/vast/Conversion/static-var-a.c b/test/vast/Conversion/static-var-a.c new file mode 100644 index 0000000000..8adf7d98b0 --- /dev/null +++ b/test/vast/Conversion/static-var-a.c @@ -0,0 +1,18 @@ +// RUN: %vast-front -vast-emit-mlir=hl -o - %s | %file-check %s -check-prefix=HL +// RUN: %check-evict-static-locals %s | %file-check %s -check-prefix=EVICTED +// RUN: %check-core-to-llvm %s | %file-check %s -check-prefix=LLVM + +// HL: hl.var @x sc_static +// HL: hl.ref @x + +// EVICTED: hl.var @foo.x {context = 0 : i64}, sc_static +// EVICTED: ll.func @foo +// EVICTED: hl.ref @foo.x + +// LLVM: llvm.mlir.global internal @foo.x() +// LLVM: llvm.func @foo +// LLVM: llvm.mlir.addressof @foo.x +int foo() { + static int x = 5; + return x++; +}