1; RUN: rm -rf %t
2; RUN: mkdir -p %t
3; RUN: lli -jit-kind=orc-lazy -enable-cache-manager -object-cache-dir=%t %s
4; RUN: lli -jit-kind=orc-lazy -enable-cache-manager -object-cache-dir=%t %s
5;
6; Verify that LLJIT Platforms respect static initializers in cached objects.
7; This IR file contains a static initializer that must execute for main to exit
8; with value zero. The first execution will populate an object cache for the
9; second. The initializer in the cached objects must also be successfully run
10; for the test to pass.
11
12@HasError = global i8 1, align 1
13@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @resetHasError, i8* null }]
14
15define void @resetHasError() {
16entry:
17  store i8 0, i8* @HasError, align 1
18  ret void
19}
20
21define i32 @main(i32 %argc, i8** %argv) #2 {
22entry:
23  %0 = load i8, i8* @HasError, align 1
24  %tobool = trunc i8 %0 to i1
25  %conv = zext i1 %tobool to i32
26  ret i32 %conv
27}
28
29