Skip to content

Commit

Permalink
test: Add scope test.
Browse files Browse the repository at this point in the history
  • Loading branch information
lkorenc committed May 16, 2024
1 parent 4d709f9 commit 66b6f1b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/vast/Conversion/FromHL/ToLLCF/for-a.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

void fn()
{
// CHECK: ll.scope {
// CHECK: ll.scope {
// CHECK-NEXT: ll.br ^bb1

Expand Down
24 changes: 24 additions & 0 deletions test/vast/Conversion/scope-a.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// RUN: %vast-front -vast-emit-mlir-after=vast-hl-to-ll-cf %s -o %t.mlir
// RUN: %file-check --input-file=%t.mlir %s -check-prefix=LL_CF

void fn(int arg)
{
// LL_CF: ll.scope {
// LL_CF: [[V3:%[0-9]+]] = ll.initialize {{.*}} : (!hl.lvalue<si32>, si32) -> !hl.lvalue<si32>
// LL_CF: ll.scope {
// LL_CF: ll.cond_br {{.8}} : i1, ^bb1, ^bb2
// LL_CF: ^bb1: // pred: ^bb0
// LL_CF: [[V9:%[0-9]+]] = hl.ref [[V3]] : (!hl.lvalue<si32>) -> !hl.lvalue<si32>
// LL_CF: {{.*}} = hl.assign {{.*}} to [[V9]] : si32, !hl.lvalue<si32> -> si32
// LL_CF: ll.br ^bb2
// LL_CF: ^bb2: // 2 preds: ^bb0, ^bb1
// LL_CF: ll.scope_ret
// LL_CF: }
// LL_CF: }
// LL_CF: ll.return {{.*}} : none
int a = 0;
{
if (arg != 0)
a = arg;
}
}

0 comments on commit 66b6f1b

Please sign in to comment.