diff options
author | Ayke van Laethem <[email protected]> | 2019-11-24 23:41:32 +0100 |
---|---|---|
committer | Ron Evans <[email protected]> | 2019-11-26 14:43:05 +0100 |
commit | 4f7a650614b3d7f6372e0f30d35b14c0b2eba515 (patch) | |
tree | dc7e331aba33ae26f7d4ebc35cc3eda0ba961708 /interp/testdata | |
parent | e74db01f8210b34faeb62f7132a81eccbba4a1ab (diff) | |
download | tinygo-4f7a650614b3d7f6372e0f30d35b14c0b2eba515.tar.gz tinygo-4f7a650614b3d7f6372e0f30d35b14c0b2eba515.zip |
interp: add test for icmp inttoptr workaround
Diffstat (limited to 'interp/testdata')
-rw-r--r-- | interp/testdata/consteval.ll | 27 | ||||
-rw-r--r-- | interp/testdata/consteval.out.ll | 8 |
2 files changed, 35 insertions, 0 deletions
diff --git a/interp/testdata/consteval.ll b/interp/testdata/consteval.ll new file mode 100644 index 000000000..7b2b1e1c1 --- /dev/null +++ b/interp/testdata/consteval.ll @@ -0,0 +1,27 @@ +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64--linux" + +@intToPtrResult = global i8 0 + +define void @runtime.initAll() { + call void @main.init() + ret void +} + +define internal void @main.init() { + call void @testIntToPtr() + ret void +} + +define internal void @testIntToPtr() { + %nil = icmp eq i8* inttoptr (i64 1024 to i8*), null + br i1 %nil, label %a, label %b +a: + ; should not be reached + store i8 1, i8* @intToPtrResult + ret void +b: + ; should be reached + store i8 2, i8* @intToPtrResult + ret void +} diff --git a/interp/testdata/consteval.out.ll b/interp/testdata/consteval.out.ll new file mode 100644 index 000000000..f1fc91558 --- /dev/null +++ b/interp/testdata/consteval.out.ll @@ -0,0 +1,8 @@ +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64--linux" + +@intToPtrResult = local_unnamed_addr global i8 2 + +define void @runtime.initAll() local_unnamed_addr { + ret void +} |