From b5961f080723eab47bdbefeed587eef2c55ad836 Mon Sep 17 00:00:00 2001 From: visualfc Date: Tue, 30 Apr 2024 08:14:08 +0800 Subject: [PATCH] cl/_testdata: add untyped test --- cl/_testdata/untyped/in.go | 11 +++++++++++ cl/_testdata/untyped/out.ll | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 cl/_testdata/untyped/in.go create mode 100644 cl/_testdata/untyped/out.ll diff --git a/cl/_testdata/untyped/in.go b/cl/_testdata/untyped/in.go new file mode 100644 index 00000000..7bccf8d6 --- /dev/null +++ b/cl/_testdata/untyped/in.go @@ -0,0 +1,11 @@ +package main + +const c = 100 + +var a float64 = 1 + +func main() { + if c > 100 { + a = 0 + } +} diff --git a/cl/_testdata/untyped/out.ll b/cl/_testdata/untyped/out.ll new file mode 100644 index 00000000..fd8b4d8e --- /dev/null +++ b/cl/_testdata/untyped/out.ll @@ -0,0 +1,32 @@ +; ModuleID = 'main' +source_filename = "main" + +@main.a = global ptr null +@"main.init$guard" = global ptr null + +define void @main.init() { +_llgo_0: + %0 = load i1, ptr @"main.init$guard", align 1 + br i1 %0, label %_llgo_2, label %_llgo_1 + +_llgo_1: ; preds = %_llgo_0 + store i1 true, ptr @"main.init$guard", align 1 + store double 1.000000e+00, ptr @main.a, align 8 + br label %_llgo_2 + +_llgo_2: ; preds = %_llgo_1, %_llgo_0 + ret void +} + +define void @main() { +_llgo_0: + call void @main.init() + br i1 false, label %_llgo_1, label %_llgo_2 + +_llgo_1: ; preds = %_llgo_0 + store double 0.000000e+00, ptr @main.a, align 8 + br label %_llgo_2 + +_llgo_2: ; preds = %_llgo_1, %_llgo_0 + ret void +}