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

Start test cleanup. #591

Merged
merged 3 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions test/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,33 @@
ToolSubst('%cc', command = 'cc')
]

passes = [
"vast-hl-splice-trailing-scopes"
, "vast-hl-to-hl-builtin"
, "vast-hl-ude"
, "vast-hl-dce"
, "vast-hl-lower-elaborated-types"
, "vast-hl-lower-typedefs"
, "vast-hl-lower-enums"
, "vast-hl-lower-types"
, "vast-hl-to-ll-func"
, "vast-hl-to-ll-vars"
, "vast-hl-to-ll-cf"
, "vast-hl-to-ll-geps"
, "vast-fn-args-to-alloca"
, "vast-lower-value-categories"
, "vast-hl-to-lazy-regions"
, "vast-emit-abi"
, "vast-lower-abi"
, "vast-irs-to-llvm"
, "vast-core-to-llvm"
]

for p in passes:
name = "%check-" + p[len("vast-"):]
tools.append(ToolSubst(name, command = 'vast-front',
extra_args = ['-vast-emit-mlir-after=' + p, '-o', '-']))

if 'BUILD_TYPE' in lit_config.params:
config.vast_build_type = lit_config.params['BUILD_TYPE']
else:
Expand Down
10 changes: 0 additions & 10 deletions test/vast/Conversion/Common/IRsToLLVM/add-a.c

This file was deleted.

10 changes: 0 additions & 10 deletions test/vast/Conversion/Common/IRsToLLVM/addfloat-a.c

This file was deleted.

8 changes: 0 additions & 8 deletions test/vast/Conversion/Common/IRsToLLVM/fn-a.c

This file was deleted.

10 changes: 0 additions & 10 deletions test/vast/Conversion/Common/IRsToLLVM/fn-b.c

This file was deleted.

10 changes: 0 additions & 10 deletions test/vast/Conversion/Generic/FnArgsToAlloca/fn-a.c

This file was deleted.

11 changes: 0 additions & 11 deletions test/vast/Conversion/Generic/FnArgsToAlloca/fn-b.c

This file was deleted.

10 changes: 10 additions & 0 deletions test/vast/Conversion/addfloat-a.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// RUN: %check-core-to-llvm %s | %file-check %s -check-prefix=C_LLVM

// C_LLVM: llvm.func @fn([[A0:%.*]]: f32, [[A1:%.*]]: f32) -> f32 {
// C_LLVM: [[R:%[0-9]+]] = llvm.fadd [[V1:%[0-9]+]], [[V2:%[0-9]+]] : f32
// C_LLVM: llvm.return [[R]] : f32
// C_LLVM: }
float fn(float arg0, float arg1)
{
return arg0 + arg1;
}
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions test/vast/Conversion/fn-a.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// RUN: %check-core-to-llvm %s | %file-check %s -check-prefix=C_LLVM

// C_LLVM: llvm.func @fn() {
// C_LLVM: llvm.return
// C_LLVM: }
void fn() {}
10 changes: 10 additions & 0 deletions test/vast/Conversion/fn-b.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// RUN: %check-core-to-llvm %s | %file-check %s -check-prefix=C_LLVM

// C_LLVM: llvm.func @fn() -> i32 {
// C_LLVM: [[V:%[0-9]+]] = llvm.mlir.constant(5 : i32) : i32
// C_LLVM: llvm.return [[V]] : i32
// C_LLVM: }
int fn()
{
return 5;
}
30 changes: 30 additions & 0 deletions test/vast/Conversion/fn-c.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// RUN: %check-fn-args-to-alloca %s | %file-check %s -check-prefix=ARGS_ALLOCA
// RUN: %check-lower-value-categories %s | %file-check %s -check-prefix=VAL_CAT
// RUN: %check-core-to-llvm %s | %file-check %s -check-prefix=C_LLVM

// ARGS_ALLOCA: ll.func @fn external ([[A1:%.*]]: si32, [[A2:%.*]]: si32) -> si32 {
// ARGS_ALLOCA: {{.*}} = ll.arg_alloca [[A1]] : (si32) -> !hl.lvalue<si32>
// ARGS_ALLOCA: {{.*}} = ll.arg_alloca [[A2]] : (si32) -> !hl.lvalue<si32>

// VAL_CAT: ll.func @fn external ([[A0:%.*]]: si32, [[A1:%.*]]: si32) -> si32 {
// VAL_CAT: [[V0:%[0-9]+]] = ll.alloca : !hl.ptr<si32>
// VAL_CAT: ll.store [[V0]], [[A0]] : !hl.ptr<si32>, si32
// VAL_CAT: [[V1:%[0-9]+]] = ll.alloca : !hl.ptr<si32>
// VAL_CAT: ll.store [[V1]], [[A1]] : !hl.ptr<si32>, si32
// VAL_CAT: {{.*}} = ll.load [[V0]] : (!hl.ptr<si32>) -> si32
// VAL_CAT: {{.*}} = ll.load [[V1]] : (!hl.ptr<si32>) -> si32

// C_LLVM: llvm.func @fn([[A0:%.*]]: i32, [[A1:%.*]]: i32) -> i32 {
// C_LLVM: [[V1:%[0-9]+]] = llvm.alloca {{.*}} x i32 : (i64) -> !llvm.ptr
// C_LLVM: llvm.store [[A0]], [[V1]] : i32, !llvm.ptr
// C_LLVM: [[V3:%[0-9]+]] = llvm.alloca {{.*}} x i32 : (i64) -> !llvm.ptr
// C_LLVM: llvm.store [[A1]], [[V3]] : i32, !llvm.ptr

int fn(int arg0, int arg1)
{
// CHECK: %0 = ll.arg_alloca %arg0 : (!hl.int) -> !hl.lvalue<!hl.int>
// CHECK: %1 = ll.arg_alloca %arg1 : (!hl.int) -> !hl.lvalue<!hl.int>
// CHECK: {{.*}} = hl.ref %0 : (!hl.lvalue<!hl.int>) -> !hl.lvalue<!hl.int>
// CHECK: {{.*}} = hl.ref %1 : (!hl.lvalue<!hl.int>) -> !hl.lvalue<!hl.int>
return arg0 + arg1;
}