interp: add test for icmp inttoptr workaround
Этот коммит содержится в:
родитель
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
предоставленный
Обычный файл
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
предоставленный
Обычный файл
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
|
||||||
|
}
|
Загрузка…
Создание таблицы
Сослаться в новой задаче