interp: add test for icmp inttoptr workaround

Этот коммит содержится в:
Ayke van Laethem 2019-11-24 23:41:32 +01:00 коммит произвёл Ron Evans
родитель e74db01f82
коммит 4f7a650614
3 изменённых файлов: 36 добавлений и 0 удалений

Просмотреть файл

@ -13,6 +13,7 @@ func TestInterp(t *testing.T) {
for _, name := range []string{ for _, name := range []string{
"basic", "basic",
"slice-copy", "slice-copy",
"consteval",
} { } {
name := name // make tc local to this closure name := name // make tc local to this closure
t.Run(name, func(t *testing.T) { t.Run(name, func(t *testing.T) {

27
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
}

8
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
}