[llvm] r344863 - [ORC] Add some more basic sanity tests for the LLJIT.

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 20 13:39:53 PDT 2018


Author: lhames
Date: Sat Oct 20 13:39:53 2018
New Revision: 344863

URL: http://llvm.org/viewvc/llvm-project?rev=344863&view=rev
Log:
[ORC] Add some more basic sanity tests for the LLJIT.

minimal.ll contains a main function that returns zero, and
single-function-call.ll contains a main function that calls a foo function that
returns zero. These minimal tests can help to rule out some trivial JIT bugs
when other tests fail.

This commit also renames hello.ll to global-ctors-and-dtors.ll, which better
reflects what it is actually testing.

Added:
    llvm/trunk/test/ExecutionEngine/OrcLazy/global-ctors-and-dtors.ll
      - copied, changed from r344860, llvm/trunk/test/ExecutionEngine/OrcLazy/hello.ll
    llvm/trunk/test/ExecutionEngine/OrcLazy/minimal.ll
    llvm/trunk/test/ExecutionEngine/OrcLazy/single-function-call.ll
Removed:
    llvm/trunk/test/ExecutionEngine/OrcLazy/hello.ll

Copied: llvm/trunk/test/ExecutionEngine/OrcLazy/global-ctors-and-dtors.ll (from r344860, llvm/trunk/test/ExecutionEngine/OrcLazy/hello.ll)
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ExecutionEngine/OrcLazy/global-ctors-and-dtors.ll?p2=llvm/trunk/test/ExecutionEngine/OrcLazy/global-ctors-and-dtors.ll&p1=llvm/trunk/test/ExecutionEngine/OrcLazy/hello.ll&r1=344860&r2=344863&rev=344863&view=diff
==============================================================================
--- llvm/trunk/test/ExecutionEngine/OrcLazy/hello.ll (original)
+++ llvm/trunk/test/ExecutionEngine/OrcLazy/global-ctors-and-dtors.ll Sat Oct 20 13:39:53 2018
@@ -1,5 +1,7 @@
 ; RUN: lli -jit-kind=orc-lazy -orc-lazy-debug=funcs-to-stdout %s | FileCheck %s
 ;
+; Test that global constructors and destructors are run.
+;
 ; CHECK: Hello
 ; CHECK: [ {{.*}}main{{.*}} ]
 ; CHECK: Goodbye

Removed: llvm/trunk/test/ExecutionEngine/OrcLazy/hello.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ExecutionEngine/OrcLazy/hello.ll?rev=344862&view=auto
==============================================================================
--- llvm/trunk/test/ExecutionEngine/OrcLazy/hello.ll (original)
+++ llvm/trunk/test/ExecutionEngine/OrcLazy/hello.ll (removed)
@@ -1,35 +0,0 @@
-; RUN: lli -jit-kind=orc-lazy -orc-lazy-debug=funcs-to-stdout %s | FileCheck %s
-;
-; CHECK: Hello
-; CHECK: [ {{.*}}main{{.*}} ]
-; CHECK: Goodbye
-
-%class.Foo = type { i8 }
-
- at f = global %class.Foo zeroinitializer, align 1
- at __dso_handle = external global i8
- at llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__sub_I_hello.cpp, i8* null }]
- at str = private unnamed_addr constant [6 x i8] c"Hello\00"
- at str2 = private unnamed_addr constant [8 x i8] c"Goodbye\00"
-
-define linkonce_odr void @_ZN3FooD1Ev(%class.Foo* nocapture readnone %this) unnamed_addr align 2 {
-entry:
-  %puts.i = tail call i32 @puts(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @str2, i64 0, i64 0))
-  ret void
-}
-
-declare i32 @__cxa_atexit(void (i8*)*, i8*, i8*)
-
-define i32 @main(i32 %argc, i8** nocapture readnone %argv) {
-entry:
-  ret i32 0
-}
-
-define internal void @_GLOBAL__sub_I_hello.cpp() {
-entry:
-  %puts.i.i.i = tail call i32 @puts(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
-  %0 = tail call i32 @__cxa_atexit(void (i8*)* bitcast (void (%class.Foo*)* @_ZN3FooD1Ev to void (i8*)*), i8* getelementptr inbounds (%class.Foo, %class.Foo* @f, i64 0, i32 0), i8* @__dso_handle)
-  ret void
-}
-
-declare i32 @puts(i8* nocapture readonly)

Added: llvm/trunk/test/ExecutionEngine/OrcLazy/minimal.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ExecutionEngine/OrcLazy/minimal.ll?rev=344863&view=auto
==============================================================================
--- llvm/trunk/test/ExecutionEngine/OrcLazy/minimal.ll (added)
+++ llvm/trunk/test/ExecutionEngine/OrcLazy/minimal.ll Sat Oct 20 13:39:53 2018
@@ -0,0 +1,8 @@
+; RUN: lli -jit-kind=orc-lazy %s
+;
+; Basic sanity check: A module with a single no-op main function runs.
+
+define i32 @main(i32 %argc, i8** nocapture readnone %argv) {
+entry:
+  ret i32 0
+}

Added: llvm/trunk/test/ExecutionEngine/OrcLazy/single-function-call.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ExecutionEngine/OrcLazy/single-function-call.ll?rev=344863&view=auto
==============================================================================
--- llvm/trunk/test/ExecutionEngine/OrcLazy/single-function-call.ll (added)
+++ llvm/trunk/test/ExecutionEngine/OrcLazy/single-function-call.ll Sat Oct 20 13:39:53 2018
@@ -0,0 +1,15 @@
+; RUN: lli -jit-kind=orc-lazy %s
+;
+; Basic sanity check: We can make a call inside lazily JIT'd code.
+; Compared to minimal.ll, this demonstrates that we can call through a stub.
+
+define i32 @foo() {
+entry:
+  ret i32 0
+}
+
+define i32 @main(i32 %argc, i8** nocapture readnone %argv) {
+entry:
+  %0 = call i32() @foo()
+  ret i32 %0
+}




More information about the llvm-commits mailing list