diff options
author | Stephen Hines <srhines@google.com> | 2015-03-23 12:10:34 -0700 |
---|---|---|
committer | Stephen Hines <srhines@google.com> | 2015-03-23 12:10:34 -0700 |
commit | ebe69fe11e48d322045d5949c83283927a0d790b (patch) | |
tree | c92f1907a6b8006628a4b01615f38264d29834ea /test/ExecutionEngine | |
parent | b7d2e72b02a4cb8034f32f8247a2558d2434e121 (diff) | |
download | external_llvm-ebe69fe11e48d322045d5949c83283927a0d790b.zip external_llvm-ebe69fe11e48d322045d5949c83283927a0d790b.tar.gz external_llvm-ebe69fe11e48d322045d5949c83283927a0d790b.tar.bz2 |
Update aosp/master LLVM for rebase to r230699.
Change-Id: I2b5be30509658cb8266be782de0ab24f9099f9b9
Diffstat (limited to 'test/ExecutionEngine')
99 files changed, 1011 insertions, 80 deletions
diff --git a/test/ExecutionEngine/MCJIT/2003-05-11-PHIRegAllocBug.ll b/test/ExecutionEngine/MCJIT/2003-05-11-PHIRegAllocBug.ll index 45279ad..2f9b143 100644 --- a/test/ExecutionEngine/MCJIT/2003-05-11-PHIRegAllocBug.ll +++ b/test/ExecutionEngine/MCJIT/2003-05-11-PHIRegAllocBug.ll @@ -1,7 +1,5 @@ ; RUN: %lli %s > /dev/null -target datalayout = "e-p:32:32" - define i32 @main() { entry: br label %endif diff --git a/test/ExecutionEngine/MCJIT/2003-06-04-bzip2-bug.ll b/test/ExecutionEngine/MCJIT/2003-06-04-bzip2-bug.ll index 4342aa4..3a25789 100644 --- a/test/ExecutionEngine/MCJIT/2003-06-04-bzip2-bug.ll +++ b/test/ExecutionEngine/MCJIT/2003-06-04-bzip2-bug.ll @@ -2,8 +2,6 @@ ; Testcase distilled from 256.bzip2. -target datalayout = "e-p:32:32" - define i32 @main() { entry: br label %loopentry.0 diff --git a/test/ExecutionEngine/MCJIT/2003-06-05-PHIBug.ll b/test/ExecutionEngine/MCJIT/2003-06-05-PHIBug.ll index 03b66c4..8a62e06 100644 --- a/test/ExecutionEngine/MCJIT/2003-06-05-PHIBug.ll +++ b/test/ExecutionEngine/MCJIT/2003-06-05-PHIBug.ll @@ -2,8 +2,6 @@ ; Testcase distilled from 256.bzip2. -target datalayout = "e-p:32:32" - define i32 @main() { entry: %X = add i32 1, -1 ; <i32> [#uses=3] diff --git a/test/ExecutionEngine/MCJIT/2010-01-15-UndefValue.ll b/test/ExecutionEngine/MCJIT/2010-01-15-UndefValue.ll deleted file mode 100644 index 8bf03de..0000000 --- a/test/ExecutionEngine/MCJIT/2010-01-15-UndefValue.ll +++ /dev/null @@ -1,8 +0,0 @@ -; RUN: %lli -force-interpreter=true %s > /dev/null - -define i32 @main() { - %a = add i32 0, undef - %b = fadd float 0.0, undef - %c = fadd double 0.0, undef - ret i32 0 -} diff --git a/test/ExecutionEngine/MCJIT/eh-lg-pic.ll b/test/ExecutionEngine/MCJIT/eh-lg-pic.ll index bd097f2..9277ec4 100644 --- a/test/ExecutionEngine/MCJIT/eh-lg-pic.ll +++ b/test/ExecutionEngine/MCJIT/eh-lg-pic.ll @@ -1,5 +1,5 @@ ; RUN: %lli -relocation-model=pic -code-model=large %s -; XFAIL: cygwin, win32, mingw, mips, i686, i386, aarch64, arm +; XFAIL: cygwin, win32, mingw, mips, i686, i386, aarch64, arm, asan, msan declare i8* @__cxa_allocate_exception(i64) declare void @__cxa_throw(i8*, i8*, i8*) declare i32 @__gxx_personality_v0(...) diff --git a/test/ExecutionEngine/MCJIT/eh-sm-pic.ll b/test/ExecutionEngine/MCJIT/eh-sm-pic.ll index f3e61dc..37fb628 100644 --- a/test/ExecutionEngine/MCJIT/eh-sm-pic.ll +++ b/test/ExecutionEngine/MCJIT/eh-sm-pic.ll @@ -1,5 +1,5 @@ ; RUN: %lli -relocation-model=pic -code-model=small %s -; XFAIL: cygwin, win32, mingw, mips, i686, i386, darwin, aarch64, arm +; XFAIL: cygwin, win32, mingw, mips, i686, i386, darwin, aarch64, arm, asan, msan declare i8* @__cxa_allocate_exception(i64) declare void @__cxa_throw(i8*, i8*, i8*) declare i32 @__gxx_personality_v0(...) diff --git a/test/ExecutionEngine/MCJIT/eh.ll b/test/ExecutionEngine/MCJIT/eh.ll index aa81bb5..9f73e3a 100644 --- a/test/ExecutionEngine/MCJIT/eh.ll +++ b/test/ExecutionEngine/MCJIT/eh.ll @@ -1,5 +1,5 @@ ; RUN: %lli %s -; XFAIL: arm, cygwin, win32, mingw +; XFAIL: arm, cygwin, win32, mingw, asan, msan declare i8* @__cxa_allocate_exception(i64) declare void @__cxa_throw(i8*, i8*, i8*) declare i32 @__gxx_personality_v0(...) diff --git a/test/ExecutionEngine/MCJIT/multi-module-eh-a.ll b/test/ExecutionEngine/MCJIT/multi-module-eh-a.ll index 10cfdcd..8626626 100644 --- a/test/ExecutionEngine/MCJIT/multi-module-eh-a.ll +++ b/test/ExecutionEngine/MCJIT/multi-module-eh-a.ll @@ -1,5 +1,5 @@ ; RUN: %lli -extra-module=%p/Inputs/multi-module-eh-b.ll %s -; XFAIL: arm, cygwin, win32, mingw +; XFAIL: arm, cygwin, win32, mingw, asan, msan declare i8* @__cxa_allocate_exception(i64) declare void @__cxa_throw(i8*, i8*, i8*) declare i32 @__gxx_personality_v0(...) diff --git a/test/ExecutionEngine/2002-12-16-ArgTest.ll b/test/ExecutionEngine/OrcJIT/2002-12-16-ArgTest.ll index eb2fe8c..e2fee8d 100644 --- a/test/ExecutionEngine/2002-12-16-ArgTest.ll +++ b/test/ExecutionEngine/OrcJIT/2002-12-16-ArgTest.ll @@ -1,4 +1,4 @@ -; RUN: %lli %s > /dev/null +; RUN: %lli -use-orcmcjit %s > /dev/null @.LC0 = internal global [10 x i8] c"argc: %d\0A\00" ; <[10 x i8]*> [#uses=1] diff --git a/test/ExecutionEngine/2003-01-04-ArgumentBug.ll b/test/ExecutionEngine/OrcJIT/2003-01-04-ArgumentBug.ll index 68fdefe..67425a9 100644 --- a/test/ExecutionEngine/2003-01-04-ArgumentBug.ll +++ b/test/ExecutionEngine/OrcJIT/2003-01-04-ArgumentBug.ll @@ -1,4 +1,4 @@ -; RUN: %lli %s > /dev/null +; RUN: %lli -use-orcmcjit %s > /dev/null define i32 @foo(i32 %X, i32 %Y, double %A) { %cond212 = fcmp une double %A, 1.000000e+00 ; <i1> [#uses=1] diff --git a/test/ExecutionEngine/2003-01-04-LoopTest.ll b/test/ExecutionEngine/OrcJIT/2003-01-04-LoopTest.ll index 5a0311d..cf805ea 100644 --- a/test/ExecutionEngine/2003-01-04-LoopTest.ll +++ b/test/ExecutionEngine/OrcJIT/2003-01-04-LoopTest.ll @@ -1,4 +1,4 @@ -; RUN: %lli %s > /dev/null +; RUN: %lli -use-orcmcjit %s > /dev/null define i32 @main() { call i32 @mylog( i32 4 ) ; <i32>:1 [#uses=0] diff --git a/test/ExecutionEngine/2003-01-04-PhiTest.ll b/test/ExecutionEngine/OrcJIT/2003-01-04-PhiTest.ll index 48576e7..b8b8519 100644 --- a/test/ExecutionEngine/2003-01-04-PhiTest.ll +++ b/test/ExecutionEngine/OrcJIT/2003-01-04-PhiTest.ll @@ -1,4 +1,4 @@ -; RUN: %lli %s > /dev/null +; RUN: %lli -use-orcmcjit %s > /dev/null define i32 @main() { ; <label>:0 diff --git a/test/ExecutionEngine/2003-01-09-SARTest.ll b/test/ExecutionEngine/OrcJIT/2003-01-09-SARTest.ll index ed58e11..85b0031 100644 --- a/test/ExecutionEngine/2003-01-09-SARTest.ll +++ b/test/ExecutionEngine/OrcJIT/2003-01-09-SARTest.ll @@ -1,4 +1,4 @@ -; RUN: %lli %s > /dev/null +; RUN: %lli -use-orcmcjit %s > /dev/null ; We were accidentally inverting the signedness of right shifts. Whoops. diff --git a/test/ExecutionEngine/2003-01-10-FUCOM.ll b/test/ExecutionEngine/OrcJIT/2003-01-10-FUCOM.ll index 4960e59..66b21c9 100644 --- a/test/ExecutionEngine/2003-01-10-FUCOM.ll +++ b/test/ExecutionEngine/OrcJIT/2003-01-10-FUCOM.ll @@ -1,4 +1,4 @@ -; RUN: %lli %s > /dev/null +; RUN: %lli -use-orcmcjit %s > /dev/null define i32 @main() { %X = fadd double 0.000000e+00, 1.000000e+00 ; <double> [#uses=1] diff --git a/test/ExecutionEngine/2003-01-15-AlignmentTest.ll b/test/ExecutionEngine/OrcJIT/2003-01-15-AlignmentTest.ll index 038d750..1f27c1f 100644 --- a/test/ExecutionEngine/2003-01-15-AlignmentTest.ll +++ b/test/ExecutionEngine/OrcJIT/2003-01-15-AlignmentTest.ll @@ -1,4 +1,4 @@ -; RUN: %lli %s > /dev/null +; RUN: %lli -use-orcmcjit %s > /dev/null define i32 @bar(i8* %X) { ; pointer should be 4 byte aligned! diff --git a/test/ExecutionEngine/2003-05-06-LivenessClobber.ll b/test/ExecutionEngine/OrcJIT/2003-05-06-LivenessClobber.ll index 576ef7c..576ef7c 100644 --- a/test/ExecutionEngine/2003-05-06-LivenessClobber.ll +++ b/test/ExecutionEngine/OrcJIT/2003-05-06-LivenessClobber.ll diff --git a/test/ExecutionEngine/2003-05-07-ArgumentTest.ll b/test/ExecutionEngine/OrcJIT/2003-05-07-ArgumentTest.ll index 42db5fe..b45178e 100644 --- a/test/ExecutionEngine/2003-05-07-ArgumentTest.ll +++ b/test/ExecutionEngine/OrcJIT/2003-05-07-ArgumentTest.ll @@ -1,4 +1,4 @@ -; RUN: %lli %s test +; RUN: %lli -use-orcmcjit %s test declare i32 @puts(i8*) diff --git a/test/ExecutionEngine/2003-05-11-PHIRegAllocBug.ll b/test/ExecutionEngine/OrcJIT/2003-05-11-PHIRegAllocBug.ll index 45279ad..68402d9 100644 --- a/test/ExecutionEngine/2003-05-11-PHIRegAllocBug.ll +++ b/test/ExecutionEngine/OrcJIT/2003-05-11-PHIRegAllocBug.ll @@ -1,6 +1,4 @@ -; RUN: %lli %s > /dev/null - -target datalayout = "e-p:32:32" +; RUN: %lli -use-orcmcjit %s > /dev/null define i32 @main() { entry: diff --git a/test/ExecutionEngine/2003-06-04-bzip2-bug.ll b/test/ExecutionEngine/OrcJIT/2003-06-04-bzip2-bug.ll index 4342aa4..0907993 100644 --- a/test/ExecutionEngine/2003-06-04-bzip2-bug.ll +++ b/test/ExecutionEngine/OrcJIT/2003-06-04-bzip2-bug.ll @@ -1,9 +1,7 @@ -; RUN: %lli %s > /dev/null +; RUN: %lli -use-orcmcjit %s > /dev/null ; Testcase distilled from 256.bzip2. -target datalayout = "e-p:32:32" - define i32 @main() { entry: br label %loopentry.0 diff --git a/test/ExecutionEngine/2003-06-05-PHIBug.ll b/test/ExecutionEngine/OrcJIT/2003-06-05-PHIBug.ll index 03b66c4..2eb497b 100644 --- a/test/ExecutionEngine/2003-06-05-PHIBug.ll +++ b/test/ExecutionEngine/OrcJIT/2003-06-05-PHIBug.ll @@ -1,9 +1,7 @@ -; RUN: %lli %s > /dev/null +; RUN: %lli -use-orcmcjit %s > /dev/null ; Testcase distilled from 256.bzip2. -target datalayout = "e-p:32:32" - define i32 @main() { entry: %X = add i32 1, -1 ; <i32> [#uses=3] diff --git a/test/ExecutionEngine/2003-08-15-AllocaAssertion.ll b/test/ExecutionEngine/OrcJIT/2003-08-15-AllocaAssertion.ll index bee409c..290d5a2 100644 --- a/test/ExecutionEngine/2003-08-15-AllocaAssertion.ll +++ b/test/ExecutionEngine/OrcJIT/2003-08-15-AllocaAssertion.ll @@ -1,4 +1,4 @@ -; RUN: %lli %s > /dev/null +; RUN: %lli -use-orcmcjit %s > /dev/null ; This testcase failed to work because two variable sized allocas confused the ; local register allocator. diff --git a/test/ExecutionEngine/2003-08-21-EnvironmentTest.ll b/test/ExecutionEngine/OrcJIT/2003-08-21-EnvironmentTest.ll index 63303fc..f73f10e 100644 --- a/test/ExecutionEngine/2003-08-21-EnvironmentTest.ll +++ b/test/ExecutionEngine/OrcJIT/2003-08-21-EnvironmentTest.ll @@ -1,4 +1,4 @@ -; RUN: %lli %s > /dev/null +; RUN: %lli -use-orcmcjit %s > /dev/null ; ; Regression Test: EnvironmentTest.ll diff --git a/test/ExecutionEngine/2003-08-23-RegisterAllocatePhysReg.ll b/test/ExecutionEngine/OrcJIT/2003-08-23-RegisterAllocatePhysReg.ll index 8fb1bbb..bd26c38 100644 --- a/test/ExecutionEngine/2003-08-23-RegisterAllocatePhysReg.ll +++ b/test/ExecutionEngine/OrcJIT/2003-08-23-RegisterAllocatePhysReg.ll @@ -1,4 +1,4 @@ -; RUN: %lli %s > /dev/null +; RUN: %lli -use-orcmcjit %s > /dev/null ; This testcase exposes a bug in the local register allocator where it runs out ; of registers (due to too many overlapping live ranges), but then attempts to diff --git a/test/ExecutionEngine/2003-10-18-PHINode-ConstantExpr-CondCode-Failure.ll b/test/ExecutionEngine/OrcJIT/2003-10-18-PHINode-ConstantExpr-CondCode-Failure.ll index 6513540..c59ad32 100644 --- a/test/ExecutionEngine/2003-10-18-PHINode-ConstantExpr-CondCode-Failure.ll +++ b/test/ExecutionEngine/OrcJIT/2003-10-18-PHINode-ConstantExpr-CondCode-Failure.ll @@ -1,4 +1,4 @@ -; RUN: %lli %s > /dev/null +; RUN: %lli -use-orcmcjit %s > /dev/null @A = global i32 0 ; <i32*> [#uses=1] diff --git a/test/ExecutionEngine/2005-12-02-TailCallBug.ll b/test/ExecutionEngine/OrcJIT/2005-12-02-TailCallBug.ll index 2ac8ad1..7f1d3b0 100644 --- a/test/ExecutionEngine/2005-12-02-TailCallBug.ll +++ b/test/ExecutionEngine/OrcJIT/2005-12-02-TailCallBug.ll @@ -1,5 +1,6 @@ ; PR672 -; RUN: %lli %s +; RUN: %lli -use-orcmcjit %s +; XFAIL: mcjit-ia32 define i32 @main() { %f = bitcast i32 (i32, i32*, i32)* @check_tail to i32* ; <i32*> [#uses=1] diff --git a/test/ExecutionEngine/2007-12-10-APIntLoadStore.ll b/test/ExecutionEngine/OrcJIT/2007-12-10-APIntLoadStore.ll index 4183611..efe5d83 100644 --- a/test/ExecutionEngine/2007-12-10-APIntLoadStore.ll +++ b/test/ExecutionEngine/OrcJIT/2007-12-10-APIntLoadStore.ll @@ -1,4 +1,4 @@ -; RUN: %lli -force-interpreter %s +; RUN: %lli -use-orcmcjit -force-interpreter %s ; PR1836 define i32 @main() { diff --git a/test/ExecutionEngine/2008-06-05-APInt-OverAShr.ll b/test/ExecutionEngine/OrcJIT/2008-06-05-APInt-OverAShr.ll index 349db69..6b27528 100644 --- a/test/ExecutionEngine/2008-06-05-APInt-OverAShr.ll +++ b/test/ExecutionEngine/OrcJIT/2008-06-05-APInt-OverAShr.ll @@ -1,4 +1,4 @@ -; RUN: %lli -force-interpreter=true %s | FileCheck %s +; RUN: %lli -use-orcmcjit -force-interpreter=true %s | FileCheck %s ; CHECK: 1 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32" diff --git a/test/ExecutionEngine/OrcJIT/2013-04-04-RelocAddend.ll b/test/ExecutionEngine/OrcJIT/2013-04-04-RelocAddend.ll new file mode 100644 index 0000000..199e948 --- /dev/null +++ b/test/ExecutionEngine/OrcJIT/2013-04-04-RelocAddend.ll @@ -0,0 +1,25 @@ +; RUN: %lli -use-orcmcjit %s +; +; Verify relocations to global symbols with addend work correctly. +; +; Compiled from this C code: +; +; int test[2] = { -1, 0 }; +; int *p = &test[1]; +; +; int main (void) +; { +; return *p; +; } +; + +@test = global [2 x i32] [i32 -1, i32 0], align 4 +@p = global i32* getelementptr inbounds ([2 x i32]* @test, i64 0, i64 1), align 8 + +define i32 @main() { +entry: + %0 = load i32** @p, align 8 + %1 = load i32* %0, align 4 + ret i32 %1 +} + diff --git a/test/ExecutionEngine/OrcJIT/Inputs/cross-module-b.ll b/test/ExecutionEngine/OrcJIT/Inputs/cross-module-b.ll new file mode 100644 index 0000000..6870117 --- /dev/null +++ b/test/ExecutionEngine/OrcJIT/Inputs/cross-module-b.ll @@ -0,0 +1,7 @@ +declare i32 @FA() + +define i32 @FB() { + %r = call i32 @FA( ) ; <i32> [#uses=1] + ret i32 %r +} + diff --git a/test/ExecutionEngine/OrcJIT/Inputs/multi-module-b.ll b/test/ExecutionEngine/OrcJIT/Inputs/multi-module-b.ll new file mode 100644 index 0000000..103b601 --- /dev/null +++ b/test/ExecutionEngine/OrcJIT/Inputs/multi-module-b.ll @@ -0,0 +1,7 @@ +declare i32 @FC() + +define i32 @FB() { + %r = call i32 @FC( ) ; <i32> [#uses=1] + ret i32 %r +} + diff --git a/test/ExecutionEngine/OrcJIT/Inputs/multi-module-c.ll b/test/ExecutionEngine/OrcJIT/Inputs/multi-module-c.ll new file mode 100644 index 0000000..b39306b --- /dev/null +++ b/test/ExecutionEngine/OrcJIT/Inputs/multi-module-c.ll @@ -0,0 +1,4 @@ +define i32 @FC() { + ret i32 0 +} + diff --git a/test/ExecutionEngine/OrcJIT/Inputs/multi-module-eh-b.ll b/test/ExecutionEngine/OrcJIT/Inputs/multi-module-eh-b.ll new file mode 100644 index 0000000..d7dbb03 --- /dev/null +++ b/test/ExecutionEngine/OrcJIT/Inputs/multi-module-eh-b.ll @@ -0,0 +1,30 @@ +declare i8* @__cxa_allocate_exception(i64) +declare void @__cxa_throw(i8*, i8*, i8*) +declare i32 @__gxx_personality_v0(...) +declare void @__cxa_end_catch() +declare i8* @__cxa_begin_catch(i8*) + +@_ZTIi = external constant i8* + +define void @throwException_B() { + %exception = tail call i8* @__cxa_allocate_exception(i64 4) + call void @__cxa_throw(i8* %exception, i8* bitcast (i8** @_ZTIi to i8*), i8* null) + unreachable +} + +define i32 @FB() { +entry: + invoke void @throwException_B() + to label %try.cont unwind label %lpad + +lpad: + %p = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + catch i8* bitcast (i8** @_ZTIi to i8*) + %e = extractvalue { i8*, i32 } %p, 0 + call i8* @__cxa_begin_catch(i8* %e) + call void @__cxa_end_catch() + br label %try.cont + +try.cont: + ret i32 0 +} diff --git a/test/ExecutionEngine/OrcJIT/cross-module-a.ll b/test/ExecutionEngine/OrcJIT/cross-module-a.ll new file mode 100644 index 0000000..14a73f5 --- /dev/null +++ b/test/ExecutionEngine/OrcJIT/cross-module-a.ll @@ -0,0 +1,13 @@ +; RUN: %lli -use-orcmcjit -extra-module=%p/Inputs/cross-module-b.ll %s > /dev/null + +declare i32 @FB() + +define i32 @FA() { + ret i32 0 +} + +define i32 @main() { + %r = call i32 @FB( ) ; <i32> [#uses=1] + ret i32 %r +} + diff --git a/test/ExecutionEngine/OrcJIT/cross-module-sm-pic-a.ll b/test/ExecutionEngine/OrcJIT/cross-module-sm-pic-a.ll new file mode 100644 index 0000000..50ad1c0 --- /dev/null +++ b/test/ExecutionEngine/OrcJIT/cross-module-sm-pic-a.ll @@ -0,0 +1,14 @@ +; RUN: %lli -use-orcmcjit -extra-module=%p/Inputs/cross-module-b.ll -relocation-model=pic -code-model=small %s > /dev/null +; XFAIL: mips, i686, i386 + +declare i32 @FB() + +define i32 @FA() { + ret i32 0 +} + +define i32 @main() { + %r = call i32 @FB( ) ; <i32> [#uses=1] + ret i32 %r +} + diff --git a/test/ExecutionEngine/OrcJIT/eh-lg-pic.ll b/test/ExecutionEngine/OrcJIT/eh-lg-pic.ll new file mode 100644 index 0000000..e5fa22c --- /dev/null +++ b/test/ExecutionEngine/OrcJIT/eh-lg-pic.ll @@ -0,0 +1,32 @@ +; RUN: %lli -use-orcmcjit -relocation-model=pic -code-model=large %s +; XFAIL: cygwin, win32, mingw, mips, i686, i386, aarch64, arm, asan, msan +declare i8* @__cxa_allocate_exception(i64) +declare void @__cxa_throw(i8*, i8*, i8*) +declare i32 @__gxx_personality_v0(...) +declare void @__cxa_end_catch() +declare i8* @__cxa_begin_catch(i8*) + +@_ZTIi = external constant i8* + +define void @throwException() { + %exception = tail call i8* @__cxa_allocate_exception(i64 4) + call void @__cxa_throw(i8* %exception, i8* bitcast (i8** @_ZTIi to i8*), i8* null) + unreachable +} + +define i32 @main() { +entry: + invoke void @throwException() + to label %try.cont unwind label %lpad + +lpad: + %p = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + catch i8* bitcast (i8** @_ZTIi to i8*) + %e = extractvalue { i8*, i32 } %p, 0 + call i8* @__cxa_begin_catch(i8* %e) + call void @__cxa_end_catch() + br label %try.cont + +try.cont: + ret i32 0 +} diff --git a/test/ExecutionEngine/OrcJIT/eh-sm-pic.ll b/test/ExecutionEngine/OrcJIT/eh-sm-pic.ll new file mode 100644 index 0000000..f22cea9 --- /dev/null +++ b/test/ExecutionEngine/OrcJIT/eh-sm-pic.ll @@ -0,0 +1,32 @@ +; RUN: %lli -use-orcmcjit -relocation-model=pic -code-model=small %s +; XFAIL: cygwin, win32, mingw, mips, i686, i386, darwin, aarch64, arm, asan, msan +declare i8* @__cxa_allocate_exception(i64) +declare void @__cxa_throw(i8*, i8*, i8*) +declare i32 @__gxx_personality_v0(...) +declare void @__cxa_end_catch() +declare i8* @__cxa_begin_catch(i8*) + +@_ZTIi = external constant i8* + +define void @throwException() { + %exception = tail call i8* @__cxa_allocate_exception(i64 4) + call void @__cxa_throw(i8* %exception, i8* bitcast (i8** @_ZTIi to i8*), i8* null) + unreachable +} + +define i32 @main() { +entry: + invoke void @throwException() + to label %try.cont unwind label %lpad + +lpad: + %p = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + catch i8* bitcast (i8** @_ZTIi to i8*) + %e = extractvalue { i8*, i32 } %p, 0 + call i8* @__cxa_begin_catch(i8* %e) + call void @__cxa_end_catch() + br label %try.cont + +try.cont: + ret i32 0 +} diff --git a/test/ExecutionEngine/OrcJIT/eh.ll b/test/ExecutionEngine/OrcJIT/eh.ll new file mode 100644 index 0000000..130146b --- /dev/null +++ b/test/ExecutionEngine/OrcJIT/eh.ll @@ -0,0 +1,32 @@ +; RUN: %lli -use-orcmcjit %s +; XFAIL: arm, cygwin, win32, mingw, asan, msan +declare i8* @__cxa_allocate_exception(i64) +declare void @__cxa_throw(i8*, i8*, i8*) +declare i32 @__gxx_personality_v0(...) +declare void @__cxa_end_catch() +declare i8* @__cxa_begin_catch(i8*) + +@_ZTIi = external constant i8* + +define void @throwException() { + %exception = tail call i8* @__cxa_allocate_exception(i64 4) + call void @__cxa_throw(i8* %exception, i8* bitcast (i8** @_ZTIi to i8*), i8* null) + unreachable +} + +define i32 @main() { +entry: + invoke void @throwException() + to label %try.cont unwind label %lpad + +lpad: + %p = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + catch i8* bitcast (i8** @_ZTIi to i8*) + %e = extractvalue { i8*, i32 } %p, 0 + call i8* @__cxa_begin_catch(i8* %e) + call void @__cxa_end_catch() + br label %try.cont + +try.cont: + ret i32 0 +} diff --git a/test/ExecutionEngine/fpbitcast.ll b/test/ExecutionEngine/OrcJIT/fpbitcast.ll index e6d06f8..0e39f88 100644 --- a/test/ExecutionEngine/fpbitcast.ll +++ b/test/ExecutionEngine/OrcJIT/fpbitcast.ll @@ -1,4 +1,4 @@ -; RUN: %lli -force-interpreter=true %s | FileCheck %s +; RUN: %lli -use-orcmcjit -force-interpreter=true %s | FileCheck %s ; CHECK: 40091eb8 define i32 @test(double %x) { diff --git a/test/ExecutionEngine/OrcJIT/hello-sm-pic.ll b/test/ExecutionEngine/OrcJIT/hello-sm-pic.ll new file mode 100644 index 0000000..ae98ae4 --- /dev/null +++ b/test/ExecutionEngine/OrcJIT/hello-sm-pic.ll @@ -0,0 +1,12 @@ +; RUN: %lli -use-orcmcjit -relocation-model=pic -code-model=small %s > /dev/null +; XFAIL: mips, i686, i386, darwin, aarch64, arm + +@.LC0 = internal global [12 x i8] c"Hello World\00" ; <[12 x i8]*> [#uses=1] + +declare i32 @puts(i8*) + +define i32 @main() { + %reg210 = call i32 @puts( i8* getelementptr ([12 x i8]* @.LC0, i64 0, i64 0) ) ; <i32> [#uses=0] + ret i32 0 +} + diff --git a/test/ExecutionEngine/hello.ll b/test/ExecutionEngine/OrcJIT/hello.ll index 47e36a5..f96e3ee 100644 --- a/test/ExecutionEngine/hello.ll +++ b/test/ExecutionEngine/OrcJIT/hello.ll @@ -1,4 +1,4 @@ -; RUN: %lli %s > /dev/null +; RUN: %lli -use-orcmcjit %s > /dev/null @.LC0 = internal global [12 x i8] c"Hello World\00" ; <[12 x i8]*> [#uses=1] diff --git a/test/ExecutionEngine/hello2.ll b/test/ExecutionEngine/OrcJIT/hello2.ll index 13b2588..9e7cf5b 100644 --- a/test/ExecutionEngine/hello2.ll +++ b/test/ExecutionEngine/OrcJIT/hello2.ll @@ -1,4 +1,4 @@ -; RUN: %lli %s > /dev/null +; RUN: %lli -use-orcmcjit %s > /dev/null @X = global i32 7 ; <i32*> [#uses=0] @msg = internal global [13 x i8] c"Hello World\0A\00" ; <[13 x i8]*> [#uses=1] diff --git a/test/ExecutionEngine/OrcJIT/lit.local.cfg b/test/ExecutionEngine/OrcJIT/lit.local.cfg new file mode 100644 index 0000000..f981403 --- /dev/null +++ b/test/ExecutionEngine/OrcJIT/lit.local.cfg @@ -0,0 +1,26 @@ +root = config.root +targets = root.targets +if ('X86' in targets) | ('AArch64' in targets) | ('ARM' in targets) | \ + ('Mips' in targets) | ('PowerPC' in targets) | ('SystemZ' in targets): + config.unsupported = False +else: + config.unsupported = True + +# FIXME: autoconf and cmake produce different arch names. We should normalize +# them before getting here. +if root.host_arch not in ['i386', 'x86', 'x86_64', 'AMD64', + 'AArch64', 'ARM', 'Mips', 'PowerPC', 'ppc64', 'SystemZ']: + config.unsupported = True + +if 'armv7' in root.host_arch: + config.unsupported = False + +if 'i386-apple-darwin' in root.target_triple: + config.unsupported = True + +if 'powerpc' in root.target_triple and not 'powerpc64' in root.target_triple: + config.unsupported = True + +# ExecutionEngine tests are not expected to pass in a cross-compilation setup. +if 'native' not in config.available_features: + config.unsupported = True diff --git a/test/ExecutionEngine/OrcJIT/load-object-a.ll b/test/ExecutionEngine/OrcJIT/load-object-a.ll new file mode 100644 index 0000000..080bf6c --- /dev/null +++ b/test/ExecutionEngine/OrcJIT/load-object-a.ll @@ -0,0 +1,24 @@ +; This first line will generate the .o files for the next run line +; RUN: rm -rf %t.cachedir %t.cachedir2 %t.cachedir3 +; RUN: mkdir -p %t.cachedir %t.cachedir2 %t.cachedir3 +; RUN: %lli -extra-module=%p/Inputs/multi-module-b.ll -extra-module=%p/Inputs/multi-module-c.ll -enable-cache-manager -object-cache-dir=%t.cachedir %s + +; Collect generated objects. +; RUN: find %t.cachedir -type f -name 'multi-module-?.o' -exec mv -v '{}' %t.cachedir2 ';' + +; This line tests MCJIT object loading +; RUN: %lli -extra-object=%t.cachedir2/multi-module-b.o -extra-object=%t.cachedir2/multi-module-c.o %s + +; These lines put the object files into an archive +; RUN: llvm-ar r %t.cachedir3/load-object.a %t.cachedir2/multi-module-b.o +; RUN: llvm-ar r %t.cachedir3/load-object.a %t.cachedir2/multi-module-c.o + +; This line test MCJIT archive loading +; RUN: %lli -extra-archive=%t.cachedir3/load-object.a %s + +declare i32 @FB() + +define i32 @main() { + %r = call i32 @FB( ) ; <i32> [#uses=1] + ret i32 %r +} diff --git a/test/ExecutionEngine/OrcJIT/multi-module-a.ll b/test/ExecutionEngine/OrcJIT/multi-module-a.ll new file mode 100644 index 0000000..587a1e8 --- /dev/null +++ b/test/ExecutionEngine/OrcJIT/multi-module-a.ll @@ -0,0 +1,9 @@ +; RUN: %lli -use-orcmcjit -extra-module=%p/Inputs/multi-module-b.ll -extra-module=%p/Inputs/multi-module-c.ll %s > /dev/null + +declare i32 @FB() + +define i32 @main() { + %r = call i32 @FB( ) ; <i32> [#uses=1] + ret i32 %r +} + diff --git a/test/ExecutionEngine/OrcJIT/multi-module-eh-a.ll b/test/ExecutionEngine/OrcJIT/multi-module-eh-a.ll new file mode 100644 index 0000000..6117e4c --- /dev/null +++ b/test/ExecutionEngine/OrcJIT/multi-module-eh-a.ll @@ -0,0 +1,35 @@ +; RUN: %lli -use-orcmcjit -extra-module=%p/Inputs/multi-module-eh-b.ll %s +; XFAIL: arm, cygwin, win32, mingw, asan, msan +declare i8* @__cxa_allocate_exception(i64) +declare void @__cxa_throw(i8*, i8*, i8*) +declare i32 @__gxx_personality_v0(...) +declare void @__cxa_end_catch() +declare i8* @__cxa_begin_catch(i8*) + +@_ZTIi = external constant i8* + +declare i32 @FB() + +define void @throwException() { + %exception = tail call i8* @__cxa_allocate_exception(i64 4) + call void @__cxa_throw(i8* %exception, i8* bitcast (i8** @_ZTIi to i8*), i8* null) + unreachable +} + +define i32 @main() { +entry: + invoke void @throwException() + to label %try.cont unwind label %lpad + +lpad: + %p = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + catch i8* bitcast (i8** @_ZTIi to i8*) + %e = extractvalue { i8*, i32 } %p, 0 + call i8* @__cxa_begin_catch(i8* %e) + call void @__cxa_end_catch() + br label %try.cont + +try.cont: + %r = call i32 @FB( ) + ret i32 %r +} diff --git a/test/ExecutionEngine/OrcJIT/multi-module-sm-pic-a.ll b/test/ExecutionEngine/OrcJIT/multi-module-sm-pic-a.ll new file mode 100644 index 0000000..b5ee3d1 --- /dev/null +++ b/test/ExecutionEngine/OrcJIT/multi-module-sm-pic-a.ll @@ -0,0 +1,10 @@ +; RUN: %lli -use-orcmcjit -extra-module=%p/Inputs/multi-module-b.ll -extra-module=%p/Inputs/multi-module-c.ll -relocation-model=pic -code-model=small %s > /dev/null +; XFAIL: mips, i686, i386 + +declare i32 @FB() + +define i32 @main() { + %r = call i32 @FB( ) ; <i32> [#uses=1] + ret i32 %r +} + diff --git a/test/ExecutionEngine/MCJIT/non-extern-addend-smallcodemodel.ll b/test/ExecutionEngine/OrcJIT/non-extern-addend.ll index 03de30a..d768e2b 100644 --- a/test/ExecutionEngine/MCJIT/non-extern-addend-smallcodemodel.ll +++ b/test/ExecutionEngine/OrcJIT/non-extern-addend.ll @@ -1,9 +1,5 @@ -; RUN: %lli -code-model=small %s > /dev/null -; XFAIL: mips -; -; FIXME: Merge this file with non-extern-addend.ll once AArch64 supports PC-rel -; relocations in ELF. (The code is identical, only the run line differs). -; +; RUN: %lli -use-orcmcjit %s > /dev/null + define i32 @foo(i32 %x, i32 %y, double %d) { entry: %d.int64 = bitcast double %d to i64 diff --git a/test/ExecutionEngine/OrcJIT/pr13727.ll b/test/ExecutionEngine/OrcJIT/pr13727.ll new file mode 100644 index 0000000..9c4f10b --- /dev/null +++ b/test/ExecutionEngine/OrcJIT/pr13727.ll @@ -0,0 +1,88 @@ +; RUN: %lli -use-orcmcjit -O0 -disable-lazy-compilation=false %s + +; The intention of this test is to verify that symbols mapped to COMMON in ELF +; work as expected. +; +; Compiled from this C code: +; +; int zero_int; +; double zero_double; +; int zero_arr[10]; +; +; int main() +; { +; zero_arr[zero_int + 5] = 40; +; +; if (zero_double < 1.1) +; zero_arr[zero_int + 2] = 70; +; +; for (int i = 1; i < 10; ++i) { +; zero_arr[i] = zero_arr[i - 1] + zero_arr[i]; +; } +; return zero_arr[9] == 110 ? 0 : -1; +; } + +@zero_int = common global i32 0, align 4 +@zero_arr = common global [10 x i32] zeroinitializer, align 16 +@zero_double = common global double 0.000000e+00, align 8 + +define i32 @main() nounwind { +entry: + %retval = alloca i32, align 4 + %i = alloca i32, align 4 + store i32 0, i32* %retval + %0 = load i32* @zero_int, align 4 + %add = add nsw i32 %0, 5 + %idxprom = sext i32 %add to i64 + %arrayidx = getelementptr inbounds [10 x i32]* @zero_arr, i32 0, i64 %idxprom + store i32 40, i32* %arrayidx, align 4 + %1 = load double* @zero_double, align 8 + %cmp = fcmp olt double %1, 1.100000e+00 + br i1 %cmp, label %if.then, label %if.end + +if.then: ; preds = %entry + %2 = load i32* @zero_int, align 4 + %add1 = add nsw i32 %2, 2 + %idxprom2 = sext i32 %add1 to i64 + %arrayidx3 = getelementptr inbounds [10 x i32]* @zero_arr, i32 0, i64 %idxprom2 + store i32 70, i32* %arrayidx3, align 4 + br label %if.end + +if.end: ; preds = %if.then, %entry + store i32 1, i32* %i, align 4 + br label %for.cond + +for.cond: ; preds = %for.inc, %if.end + %3 = load i32* %i, align 4 + %cmp4 = icmp slt i32 %3, 10 + br i1 %cmp4, label %for.body, label %for.end + +for.body: ; preds = %for.cond + %4 = load i32* %i, align 4 + %sub = sub nsw i32 %4, 1 + %idxprom5 = sext i32 %sub to i64 + %arrayidx6 = getelementptr inbounds [10 x i32]* @zero_arr, i32 0, i64 %idxprom5 + %5 = load i32* %arrayidx6, align 4 + %6 = load i32* %i, align 4 + %idxprom7 = sext i32 %6 to i64 + %arrayidx8 = getelementptr inbounds [10 x i32]* @zero_arr, i32 0, i64 %idxprom7 + %7 = load i32* %arrayidx8, align 4 + %add9 = add nsw i32 %5, %7 + %8 = load i32* %i, align 4 + %idxprom10 = sext i32 %8 to i64 + %arrayidx11 = getelementptr inbounds [10 x i32]* @zero_arr, i32 0, i64 %idxprom10 + store i32 %add9, i32* %arrayidx11, align 4 + br label %for.inc + +for.inc: ; preds = %for.body + %9 = load i32* %i, align 4 + %inc = add nsw i32 %9, 1 + store i32 %inc, i32* %i, align 4 + br label %for.cond + +for.end: ; preds = %for.cond + %10 = load i32* getelementptr inbounds ([10 x i32]* @zero_arr, i32 0, i64 9), align 4 + %cmp12 = icmp eq i32 %10, 110 + %cond = select i1 %cmp12, i32 0, i32 -1 + ret i32 %cond +} diff --git a/test/ExecutionEngine/OrcJIT/remote/Inputs/cross-module-b.ll b/test/ExecutionEngine/OrcJIT/remote/Inputs/cross-module-b.ll new file mode 100644 index 0000000..bc13b1d --- /dev/null +++ b/test/ExecutionEngine/OrcJIT/remote/Inputs/cross-module-b.ll @@ -0,0 +1,7 @@ +declare i32 @FA() + +define i32 @FB() nounwind { + %r = call i32 @FA( ) ; <i32> [#uses=1] + ret i32 %r +} + diff --git a/test/ExecutionEngine/OrcJIT/remote/Inputs/multi-module-b.ll b/test/ExecutionEngine/OrcJIT/remote/Inputs/multi-module-b.ll new file mode 100644 index 0000000..0b8d5eb --- /dev/null +++ b/test/ExecutionEngine/OrcJIT/remote/Inputs/multi-module-b.ll @@ -0,0 +1,7 @@ +declare i32 @FC() + +define i32 @FB() nounwind { + %r = call i32 @FC( ) ; <i32> [#uses=1] + ret i32 %r +} + diff --git a/test/ExecutionEngine/OrcJIT/remote/Inputs/multi-module-c.ll b/test/ExecutionEngine/OrcJIT/remote/Inputs/multi-module-c.ll new file mode 100644 index 0000000..98350a8 --- /dev/null +++ b/test/ExecutionEngine/OrcJIT/remote/Inputs/multi-module-c.ll @@ -0,0 +1,4 @@ +define i32 @FC() nounwind { + ret i32 0 +} + diff --git a/test/ExecutionEngine/OrcJIT/remote/cross-module-a.ll b/test/ExecutionEngine/OrcJIT/remote/cross-module-a.ll new file mode 100644 index 0000000..c315723 --- /dev/null +++ b/test/ExecutionEngine/OrcJIT/remote/cross-module-a.ll @@ -0,0 +1,12 @@ +; RUN: %lli -extra-module=%p/Inputs/cross-module-b.ll -disable-lazy-compilation=true -remote-mcjit -mcjit-remote-process=lli-child-target%exeext %s > /dev/null + +declare i32 @FB() + +define i32 @FA() nounwind { + ret i32 0 +} + +define i32 @main() nounwind { + %r = call i32 @FB( ) ; <i32> [#uses=1] + ret i32 %r +} diff --git a/test/ExecutionEngine/OrcJIT/remote/cross-module-sm-pic-a.ll b/test/ExecutionEngine/OrcJIT/remote/cross-module-sm-pic-a.ll new file mode 100644 index 0000000..d47fc6c --- /dev/null +++ b/test/ExecutionEngine/OrcJIT/remote/cross-module-sm-pic-a.ll @@ -0,0 +1,14 @@ +; RUN: %lli -extra-module=%p/Inputs/cross-module-b.ll -disable-lazy-compilation=true -remote-mcjit -mcjit-remote-process=lli-child-target%exeext -relocation-model=pic -code-model=small %s > /dev/null +; XFAIL: mips, i686, i386, arm + +declare i32 @FB() + +define i32 @FA() { + ret i32 0 +} + +define i32 @main() { + %r = call i32 @FB( ) ; <i32> [#uses=1] + ret i32 %r +} + diff --git a/test/ExecutionEngine/OrcJIT/remote/lit.local.cfg b/test/ExecutionEngine/OrcJIT/remote/lit.local.cfg new file mode 100644 index 0000000..625d82d --- /dev/null +++ b/test/ExecutionEngine/OrcJIT/remote/lit.local.cfg @@ -0,0 +1,8 @@ +if 'armv4' in config.root.target_triple or \ + 'armv5' in config.root.target_triple: + config.unsupported = True + +# This is temporary, until Remote MCJIT works on ARM +# See http://llvm.org/bugs/show_bug.cgi?id=18057 +#if 'armv7' in config.root.target_triple: +# config.unsupported = True diff --git a/test/ExecutionEngine/OrcJIT/remote/multi-module-a.ll b/test/ExecutionEngine/OrcJIT/remote/multi-module-a.ll new file mode 100644 index 0000000..0fd363b --- /dev/null +++ b/test/ExecutionEngine/OrcJIT/remote/multi-module-a.ll @@ -0,0 +1,9 @@ +; RUN: %lli -extra-module=%p/Inputs/multi-module-b.ll -extra-module=%p/Inputs/multi-module-c.ll -disable-lazy-compilation=true -remote-mcjit -mcjit-remote-process=lli-child-target%exeext %s > /dev/null + +declare i32 @FB() + +define i32 @main() nounwind { + %r = call i32 @FB( ) ; <i32> [#uses=1] + ret i32 %r +} + diff --git a/test/ExecutionEngine/OrcJIT/remote/multi-module-sm-pic-a.ll b/test/ExecutionEngine/OrcJIT/remote/multi-module-sm-pic-a.ll new file mode 100644 index 0000000..d248c4b --- /dev/null +++ b/test/ExecutionEngine/OrcJIT/remote/multi-module-sm-pic-a.ll @@ -0,0 +1,10 @@ +; RUN: %lli -extra-module=%p/Inputs/multi-module-b.ll -extra-module=%p/Inputs/multi-module-c.ll -disable-lazy-compilation=true -remote-mcjit -mcjit-remote-process=lli-child-target%exeext -relocation-model=pic -code-model=small %s > /dev/null +; XFAIL: mips, i686, i386, arm + +declare i32 @FB() + +define i32 @main() { + %r = call i32 @FB( ) ; <i32> [#uses=1] + ret i32 %r +} + diff --git a/test/ExecutionEngine/OrcJIT/remote/simpletest-remote.ll b/test/ExecutionEngine/OrcJIT/remote/simpletest-remote.ll new file mode 100644 index 0000000..30b4dd8 --- /dev/null +++ b/test/ExecutionEngine/OrcJIT/remote/simpletest-remote.ll @@ -0,0 +1,10 @@ +; RUN: %lli -remote-mcjit -mcjit-remote-process=lli-child-target%exeext %s > /dev/null + +define i32 @bar() nounwind { + ret i32 0 +} + +define i32 @main() nounwind { + %r = call i32 @bar( ) ; <i32> [#uses=1] + ret i32 %r +} diff --git a/test/ExecutionEngine/OrcJIT/remote/stubs-remote.ll b/test/ExecutionEngine/OrcJIT/remote/stubs-remote.ll new file mode 100644 index 0000000..da4ddc6 --- /dev/null +++ b/test/ExecutionEngine/OrcJIT/remote/stubs-remote.ll @@ -0,0 +1,37 @@ +; RUN: %lli -remote-mcjit -disable-lazy-compilation=false -mcjit-remote-process=lli-child-target%exeext %s +; XFAIL: * +; This test should fail until remote symbol resolution is supported. + +define i32 @main() nounwind { +entry: + call void @lazily_compiled_address_is_consistent() + ret i32 0 +} + +; Test PR3043: @test should have the same address before and after +; it's JIT-compiled. +@funcPtr = common global i1 ()* null, align 4 +@lcaic_failure = internal constant [46 x i8] c"@lazily_compiled_address_is_consistent failed\00" + +define void @lazily_compiled_address_is_consistent() nounwind { +entry: + store i1 ()* @test, i1 ()** @funcPtr + %pass = tail call i1 @test() ; <i32> [#uses=1] + br i1 %pass, label %pass_block, label %fail_block +pass_block: + ret void +fail_block: + call i32 @puts(i8* getelementptr([46 x i8]* @lcaic_failure, i32 0, i32 0)) + call void @exit(i32 1) + unreachable +} + +define i1 @test() nounwind { +entry: + %tmp = load i1 ()** @funcPtr + %eq = icmp eq i1 ()* %tmp, @test + ret i1 %eq +} + +declare i32 @puts(i8*) noreturn +declare void @exit(i32) noreturn diff --git a/test/ExecutionEngine/OrcJIT/remote/stubs-sm-pic.ll b/test/ExecutionEngine/OrcJIT/remote/stubs-sm-pic.ll new file mode 100644 index 0000000..f6a1607 --- /dev/null +++ b/test/ExecutionEngine/OrcJIT/remote/stubs-sm-pic.ll @@ -0,0 +1,37 @@ +; RUN: %lli -remote-mcjit -disable-lazy-compilation=false -relocation-model=pic -code-model=small %s +; XFAIL: * +; This function should fail until remote symbol resolution is supported. + +define i32 @main() nounwind { +entry: + call void @lazily_compiled_address_is_consistent() + ret i32 0 +} + +; Test PR3043: @test should have the same address before and after +; it's JIT-compiled. +@funcPtr = common global i1 ()* null, align 4 +@lcaic_failure = internal constant [46 x i8] c"@lazily_compiled_address_is_consistent failed\00" + +define void @lazily_compiled_address_is_consistent() nounwind { +entry: + store i1 ()* @test, i1 ()** @funcPtr + %pass = tail call i1 @test() ; <i32> [#uses=1] + br i1 %pass, label %pass_block, label %fail_block +pass_block: + ret void +fail_block: + call i32 @puts(i8* getelementptr([46 x i8]* @lcaic_failure, i32 0, i32 0)) + call void @exit(i32 1) + unreachable +} + +define i1 @test() nounwind { +entry: + %tmp = load i1 ()** @funcPtr + %eq = icmp eq i1 ()* %tmp, @test + ret i1 %eq +} + +declare i32 @puts(i8*) noreturn +declare void @exit(i32) noreturn diff --git a/test/ExecutionEngine/OrcJIT/remote/test-common-symbols-remote.ll b/test/ExecutionEngine/OrcJIT/remote/test-common-symbols-remote.ll new file mode 100644 index 0000000..0f58710 --- /dev/null +++ b/test/ExecutionEngine/OrcJIT/remote/test-common-symbols-remote.ll @@ -0,0 +1,88 @@ +; RUN: %lli -remote-mcjit -O0 -disable-lazy-compilation=false -mcjit-remote-process=lli-child-target%exeext %s + +; The intention of this test is to verify that symbols mapped to COMMON in ELF +; work as expected. +; +; Compiled from this C code: +; +; int zero_int; +; double zero_double; +; int zero_arr[10]; +; +; int main() +; { +; zero_arr[zero_int + 5] = 40; +; +; if (zero_double < 1.0) +; zero_arr[zero_int + 2] = 70; +; +; for (int i = 1; i < 10; ++i) { +; zero_arr[i] = zero_arr[i - 1] + zero_arr[i]; +; } +; return zero_arr[9] == 110 ? 0 : -1; +; } + +@zero_int = common global i32 0, align 4 +@zero_arr = common global [10 x i32] zeroinitializer, align 16 +@zero_double = common global double 0.000000e+00, align 8 + +define i32 @main() nounwind { +entry: + %retval = alloca i32, align 4 + %i = alloca i32, align 4 + store i32 0, i32* %retval + %0 = load i32* @zero_int, align 4 + %add = add nsw i32 %0, 5 + %idxprom = sext i32 %add to i64 + %arrayidx = getelementptr inbounds [10 x i32]* @zero_arr, i32 0, i64 %idxprom + store i32 40, i32* %arrayidx, align 4 + %1 = load double* @zero_double, align 8 + %cmp = fcmp olt double %1, 1.000000e+00 + br i1 %cmp, label %if.then, label %if.end + +if.then: ; preds = %entry + %2 = load i32* @zero_int, align 4 + %add1 = add nsw i32 %2, 2 + %idxprom2 = sext i32 %add1 to i64 + %arrayidx3 = getelementptr inbounds [10 x i32]* @zero_arr, i32 0, i64 %idxprom2 + store i32 70, i32* %arrayidx3, align 4 + br label %if.end + +if.end: ; preds = %if.then, %entry + store i32 1, i32* %i, align 4 + br label %for.cond + +for.cond: ; preds = %for.inc, %if.end + %3 = load i32* %i, align 4 + %cmp4 = icmp slt i32 %3, 10 + br i1 %cmp4, label %for.body, label %for.end + +for.body: ; preds = %for.cond + %4 = load i32* %i, align 4 + %sub = sub nsw i32 %4, 1 + %idxprom5 = sext i32 %sub to i64 + %arrayidx6 = getelementptr inbounds [10 x i32]* @zero_arr, i32 0, i64 %idxprom5 + %5 = load i32* %arrayidx6, align 4 + %6 = load i32* %i, align 4 + %idxprom7 = sext i32 %6 to i64 + %arrayidx8 = getelementptr inbounds [10 x i32]* @zero_arr, i32 0, i64 %idxprom7 + %7 = load i32* %arrayidx8, align 4 + %add9 = add nsw i32 %5, %7 + %8 = load i32* %i, align 4 + %idxprom10 = sext i32 %8 to i64 + %arrayidx11 = getelementptr inbounds [10 x i32]* @zero_arr, i32 0, i64 %idxprom10 + store i32 %add9, i32* %arrayidx11, align 4 + br label %for.inc + +for.inc: ; preds = %for.body + %9 = load i32* %i, align 4 + %inc = add nsw i32 %9, 1 + store i32 %inc, i32* %i, align 4 + br label %for.cond + +for.end: ; preds = %for.cond + %10 = load i32* getelementptr inbounds ([10 x i32]* @zero_arr, i32 0, i64 9), align 4 + %cmp12 = icmp eq i32 %10, 110 + %cond = select i1 %cmp12, i32 0, i32 -1 + ret i32 %cond +} diff --git a/test/ExecutionEngine/OrcJIT/remote/test-data-align-remote.ll b/test/ExecutionEngine/OrcJIT/remote/test-data-align-remote.ll new file mode 100644 index 0000000..435c21a --- /dev/null +++ b/test/ExecutionEngine/OrcJIT/remote/test-data-align-remote.ll @@ -0,0 +1,15 @@ +; RUN: %lli -remote-mcjit -O0 -mcjit-remote-process=lli-child-target%exeext %s + +; Check that a variable is always aligned as specified. + +@var = global i32 0, align 32 +define i32 @main() nounwind { + %addr = ptrtoint i32* @var to i64 + %mask = and i64 %addr, 31 + %tst = icmp eq i64 %mask, 0 + br i1 %tst, label %good, label %bad +good: + ret i32 0 +bad: + ret i32 1 +} diff --git a/test/ExecutionEngine/OrcJIT/remote/test-fp-no-external-funcs-remote.ll b/test/ExecutionEngine/OrcJIT/remote/test-fp-no-external-funcs-remote.ll new file mode 100644 index 0000000..9d11415 --- /dev/null +++ b/test/ExecutionEngine/OrcJIT/remote/test-fp-no-external-funcs-remote.ll @@ -0,0 +1,20 @@ +; RUN: %lli -remote-mcjit -mcjit-remote-process=lli-child-target%exeext %s > /dev/null + +define double @test(double* %DP, double %Arg) nounwind { + %D = load double* %DP ; <double> [#uses=1] + %V = fadd double %D, 1.000000e+00 ; <double> [#uses=2] + %W = fsub double %V, %V ; <double> [#uses=3] + %X = fmul double %W, %W ; <double> [#uses=2] + %Y = fdiv double %X, %X ; <double> [#uses=2] + %Q = fadd double %Y, %Arg ; <double> [#uses=1] + %R = bitcast double %Q to double ; <double> [#uses=1] + store double %Q, double* %DP + ret double %Y +} + +define i32 @main() nounwind { + %X = alloca double ; <double*> [#uses=2] + store double 0.000000e+00, double* %X + call double @test( double* %X, double 2.000000e+00 ) ; <double>:1 [#uses=0] + ret i32 0 +} diff --git a/test/ExecutionEngine/OrcJIT/remote/test-global-init-nonzero-remote.ll b/test/ExecutionEngine/OrcJIT/remote/test-global-init-nonzero-remote.ll new file mode 100644 index 0000000..40b514f --- /dev/null +++ b/test/ExecutionEngine/OrcJIT/remote/test-global-init-nonzero-remote.ll @@ -0,0 +1,34 @@ +; RUN: %lli -remote-mcjit -mcjit-remote-process=lli-child-target%exeext %s > /dev/null + +@count = global i32 1, align 4 + +define i32 @main() nounwind { +entry: + %retval = alloca i32, align 4 + %i = alloca i32, align 4 + store i32 0, i32* %retval + store i32 0, i32* %i, align 4 + br label %for.cond + +for.cond: ; preds = %for.inc, %entry + %0 = load i32* %i, align 4 + %cmp = icmp slt i32 %0, 49 + br i1 %cmp, label %for.body, label %for.end + +for.body: ; preds = %for.cond + %1 = load i32* @count, align 4 + %inc = add nsw i32 %1, 1 + store i32 %inc, i32* @count, align 4 + br label %for.inc + +for.inc: ; preds = %for.body + %2 = load i32* %i, align 4 + %inc1 = add nsw i32 %2, 1 + store i32 %inc1, i32* %i, align 4 + br label %for.cond + +for.end: ; preds = %for.cond + %3 = load i32* @count, align 4 + %sub = sub nsw i32 %3, 50 + ret i32 %sub +} diff --git a/test/ExecutionEngine/OrcJIT/remote/test-global-init-nonzero-sm-pic.ll b/test/ExecutionEngine/OrcJIT/remote/test-global-init-nonzero-sm-pic.ll new file mode 100644 index 0000000..5119b72 --- /dev/null +++ b/test/ExecutionEngine/OrcJIT/remote/test-global-init-nonzero-sm-pic.ll @@ -0,0 +1,35 @@ +; RUN: %lli -remote-mcjit -relocation-model=pic -code-model=small %s > /dev/null +; XFAIL: mips, aarch64, arm, i686, i386 + +@count = global i32 1, align 4 + +define i32 @main() nounwind uwtable { +entry: + %retval = alloca i32, align 4 + %i = alloca i32, align 4 + store i32 0, i32* %retval + store i32 0, i32* %i, align 4 + br label %for.cond + +for.cond: ; preds = %for.inc, %entry + %0 = load i32* %i, align 4 + %cmp = icmp slt i32 %0, 49 + br i1 %cmp, label %for.body, label %for.end + +for.body: ; preds = %for.cond + %1 = load i32* @count, align 4 + %inc = add nsw i32 %1, 1 + store i32 %inc, i32* @count, align 4 + br label %for.inc + +for.inc: ; preds = %for.body + %2 = load i32* %i, align 4 + %inc1 = add nsw i32 %2, 1 + store i32 %inc1, i32* %i, align 4 + br label %for.cond + +for.end: ; preds = %for.cond + %3 = load i32* @count, align 4 + %sub = sub nsw i32 %3, 50 + ret i32 %sub +} diff --git a/test/ExecutionEngine/OrcJIT/remote/test-ptr-reloc-remote.ll b/test/ExecutionEngine/OrcJIT/remote/test-ptr-reloc-remote.ll new file mode 100644 index 0000000..ba3ffff --- /dev/null +++ b/test/ExecutionEngine/OrcJIT/remote/test-ptr-reloc-remote.ll @@ -0,0 +1,15 @@ +; RUN: %lli -remote-mcjit -O0 -mcjit-remote-process=lli-child-target%exeext %s + +@.str = private unnamed_addr constant [6 x i8] c"data1\00", align 1 +@ptr = global i8* getelementptr inbounds ([6 x i8]* @.str, i32 0, i32 0), align 4 +@.str1 = private unnamed_addr constant [6 x i8] c"data2\00", align 1 +@ptr2 = global i8* getelementptr inbounds ([6 x i8]* @.str1, i32 0, i32 0), align 4 + +define i32 @main(i32 %argc, i8** nocapture %argv) nounwind readonly { +entry: + %0 = load i8** @ptr, align 4 + %1 = load i8** @ptr2, align 4 + %cmp = icmp eq i8* %0, %1 + %. = zext i1 %cmp to i32 + ret i32 %. +} diff --git a/test/ExecutionEngine/OrcJIT/remote/test-ptr-reloc-sm-pic.ll b/test/ExecutionEngine/OrcJIT/remote/test-ptr-reloc-sm-pic.ll new file mode 100644 index 0000000..bbc71af --- /dev/null +++ b/test/ExecutionEngine/OrcJIT/remote/test-ptr-reloc-sm-pic.ll @@ -0,0 +1,17 @@ +; RUN: %lli -remote-mcjit -O0 -relocation-model=pic -code-model=small %s +; XFAIL: mips, aarch64, arm, i686, i386 + +@.str = private unnamed_addr constant [6 x i8] c"data1\00", align 1 +@ptr = global i8* getelementptr inbounds ([6 x i8]* @.str, i32 0, i32 0), align 4 +@.str1 = private unnamed_addr constant [6 x i8] c"data2\00", align 1 +@ptr2 = global i8* getelementptr inbounds ([6 x i8]* @.str1, i32 0, i32 0), align 4 + +define i32 @main(i32 %argc, i8** nocapture %argv) nounwind readonly { +entry: + %0 = load i8** @ptr, align 4 + %1 = load i8** @ptr2, align 4 + %cmp = icmp eq i8* %0, %1 + %. = zext i1 %cmp to i32 + ret i32 %. +} + diff --git a/test/ExecutionEngine/OrcJIT/simplesttest.ll b/test/ExecutionEngine/OrcJIT/simplesttest.ll new file mode 100644 index 0000000..c2f24f6 --- /dev/null +++ b/test/ExecutionEngine/OrcJIT/simplesttest.ll @@ -0,0 +1,6 @@ +; RUN: %lli -use-orcmcjit %s > /dev/null + +define i32 @main() { + ret i32 0 +} + diff --git a/test/ExecutionEngine/simpletest.ll b/test/ExecutionEngine/OrcJIT/simpletest.ll index 167a0fd..e99f615 100644 --- a/test/ExecutionEngine/simpletest.ll +++ b/test/ExecutionEngine/OrcJIT/simpletest.ll @@ -1,4 +1,4 @@ -; RUN: %lli %s > /dev/null +; RUN: %lli -use-orcmcjit %s > /dev/null define i32 @bar() { ret i32 0 diff --git a/test/ExecutionEngine/OrcJIT/stubs-sm-pic.ll b/test/ExecutionEngine/OrcJIT/stubs-sm-pic.ll new file mode 100644 index 0000000..28f8a76 --- /dev/null +++ b/test/ExecutionEngine/OrcJIT/stubs-sm-pic.ll @@ -0,0 +1,36 @@ +; RUN: %lli -use-orcmcjit -disable-lazy-compilation=false -relocation-model=pic -code-model=small %s +; XFAIL: mips, i686, i386, aarch64, arm + +define i32 @main() nounwind { +entry: + call void @lazily_compiled_address_is_consistent() + ret i32 0 +} + +; Test PR3043: @test should have the same address before and after +; it's JIT-compiled. +@funcPtr = common global i1 ()* null, align 4 +@lcaic_failure = internal constant [46 x i8] c"@lazily_compiled_address_is_consistent failed\00" + +define void @lazily_compiled_address_is_consistent() nounwind { +entry: + store i1 ()* @test, i1 ()** @funcPtr + %pass = tail call i1 @test() ; <i32> [#uses=1] + br i1 %pass, label %pass_block, label %fail_block +pass_block: + ret void +fail_block: + call i32 @puts(i8* getelementptr([46 x i8]* @lcaic_failure, i32 0, i32 0)) + call void @exit(i32 1) + unreachable +} + +define i1 @test() nounwind { +entry: + %tmp = load i1 ()** @funcPtr + %eq = icmp eq i1 ()* %tmp, @test + ret i1 %eq +} + +declare i32 @puts(i8*) noreturn +declare void @exit(i32) noreturn diff --git a/test/ExecutionEngine/stubs.ll b/test/ExecutionEngine/OrcJIT/stubs.ll index b7d922f..ec3c458 100644 --- a/test/ExecutionEngine/stubs.ll +++ b/test/ExecutionEngine/OrcJIT/stubs.ll @@ -1,4 +1,4 @@ -; RUN: %lli -disable-lazy-compilation=false %s +; RUN: %lli -use-orcmcjit -disable-lazy-compilation=false %s define i32 @main() nounwind { entry: diff --git a/test/ExecutionEngine/test-arith.ll b/test/ExecutionEngine/OrcJIT/test-arith.ll index 79f989f..b662567 100644 --- a/test/ExecutionEngine/test-arith.ll +++ b/test/ExecutionEngine/OrcJIT/test-arith.ll @@ -1,4 +1,4 @@ -; RUN: %lli %s > /dev/null +; RUN: %lli -use-orcmcjit %s > /dev/null define i32 @main() { %A = add i8 0, 12 ; <i8> [#uses=1] diff --git a/test/ExecutionEngine/test-branch.ll b/test/ExecutionEngine/OrcJIT/test-branch.ll index 3ae55d0..b66cfaf 100644 --- a/test/ExecutionEngine/test-branch.ll +++ b/test/ExecutionEngine/OrcJIT/test-branch.ll @@ -1,4 +1,4 @@ -; RUN: %lli %s > /dev/null +; RUN: %lli -use-orcmcjit %s > /dev/null ; test unconditional branch define i32 @main() { diff --git a/test/ExecutionEngine/test-call-no-external-funcs.ll b/test/ExecutionEngine/OrcJIT/test-call-no-external-funcs.ll index c3cb931..c536efe 100644 --- a/test/ExecutionEngine/test-call-no-external-funcs.ll +++ b/test/ExecutionEngine/OrcJIT/test-call-no-external-funcs.ll @@ -1,4 +1,4 @@ -; RUN: %lli %s > /dev/null +; RUN: %lli -use-orcmcjit %s > /dev/null define i32 @_Z14func_exit_codev() nounwind uwtable { entry: diff --git a/test/ExecutionEngine/test-call.ll b/test/ExecutionEngine/OrcJIT/test-call.ll index 313a6c5..8f50bdc 100644 --- a/test/ExecutionEngine/test-call.ll +++ b/test/ExecutionEngine/OrcJIT/test-call.ll @@ -1,4 +1,4 @@ -; RUN: %lli %s > /dev/null +; RUN: %lli -use-orcmcjit %s > /dev/null declare void @exit(i32) diff --git a/test/ExecutionEngine/test-cast.ll b/test/ExecutionEngine/OrcJIT/test-cast.ll index 667fa80..4efd760 100644 --- a/test/ExecutionEngine/test-cast.ll +++ b/test/ExecutionEngine/OrcJIT/test-cast.ll @@ -1,4 +1,4 @@ -; RUN: %lli %s > /dev/null +; RUN: %lli -use-orcmcjit %s > /dev/null define i32 @foo() { ret i32 0 diff --git a/test/ExecutionEngine/OrcJIT/test-common-symbols-alignment.ll b/test/ExecutionEngine/OrcJIT/test-common-symbols-alignment.ll new file mode 100644 index 0000000..35349e3 --- /dev/null +++ b/test/ExecutionEngine/OrcJIT/test-common-symbols-alignment.ll @@ -0,0 +1,32 @@ +; RUN: %lli -use-orcmcjit -O0 %s + +; This test checks that common symbols have been allocated addresses honouring +; the alignment requirement. + +@CS1 = common global i32 0, align 16 +@CS2 = common global i8 0, align 1 +@CS3 = common global i32 0, align 16 + +define i32 @main() nounwind { +entry: + %retval = alloca i32, align 4 + %ptr = alloca i32, align 4 + store i32 0, i32* %retval + store i32 ptrtoint (i32* @CS3 to i32), i32* %ptr, align 4 + %0 = load i32* %ptr, align 4 + %and = and i32 %0, 15 + %tobool = icmp ne i32 %and, 0 + br i1 %tobool, label %if.then, label %if.else + +if.then: ; preds = %entry + store i32 1, i32* %retval + br label %return + +if.else: ; preds = %entry + store i32 0, i32* %retval + br label %return + +return: ; preds = %if.else, %if.then + %1 = load i32* %retval + ret i32 %1 +} diff --git a/test/ExecutionEngine/test-common-symbols.ll b/test/ExecutionEngine/OrcJIT/test-common-symbols.ll index 19e2ce5..7129e14 100644 --- a/test/ExecutionEngine/test-common-symbols.ll +++ b/test/ExecutionEngine/OrcJIT/test-common-symbols.ll @@ -1,4 +1,4 @@ -; RUN: %lli -O0 -disable-lazy-compilation=false %s +; RUN: %lli -use-orcmcjit -O0 -disable-lazy-compilation=false %s ; The intention of this test is to verify that symbols mapped to COMMON in ELF ; work as expected. diff --git a/test/ExecutionEngine/test-constantexpr.ll b/test/ExecutionEngine/OrcJIT/test-constantexpr.ll index d01479a..380848c 100644 --- a/test/ExecutionEngine/test-constantexpr.ll +++ b/test/ExecutionEngine/OrcJIT/test-constantexpr.ll @@ -1,4 +1,4 @@ -; RUN: %lli %s > /dev/null +; RUN: %lli -use-orcmcjit %s > /dev/null ; This tests to make sure that we can evaluate weird constant expressions diff --git a/test/ExecutionEngine/OrcJIT/test-data-align.ll b/test/ExecutionEngine/OrcJIT/test-data-align.ll new file mode 100644 index 0000000..f76dda9 --- /dev/null +++ b/test/ExecutionEngine/OrcJIT/test-data-align.ll @@ -0,0 +1,15 @@ +; RUN: %lli -use-orcmcjit -O0 %s + +; Check that a variable is always aligned as specified. + +@var = global i32 0, align 32 +define i32 @main() { + %addr = ptrtoint i32* @var to i64 + %mask = and i64 %addr, 31 + %tst = icmp eq i64 %mask, 0 + br i1 %tst, label %good, label %bad +good: + ret i32 0 +bad: + ret i32 1 +} diff --git a/test/ExecutionEngine/test-fp-no-external-funcs.ll b/test/ExecutionEngine/OrcJIT/test-fp-no-external-funcs.ll index 61b12c2..cf8db4c 100644 --- a/test/ExecutionEngine/test-fp-no-external-funcs.ll +++ b/test/ExecutionEngine/OrcJIT/test-fp-no-external-funcs.ll @@ -1,4 +1,4 @@ -; RUN: %lli %s > /dev/null +; RUN: %lli -use-orcmcjit %s > /dev/null define double @test(double* %DP, double %Arg) { %D = load double* %DP ; <double> [#uses=1] diff --git a/test/ExecutionEngine/test-fp.ll b/test/ExecutionEngine/OrcJIT/test-fp.ll index 2bf0210..77a4c7e 100644 --- a/test/ExecutionEngine/test-fp.ll +++ b/test/ExecutionEngine/OrcJIT/test-fp.ll @@ -1,4 +1,4 @@ -; RUN: %lli %s > /dev/null +; RUN: %lli -use-orcmcjit %s > /dev/null define double @test(double* %DP, double %Arg) { %D = load double* %DP ; <double> [#uses=1] diff --git a/test/ExecutionEngine/OrcJIT/test-global-ctors.ll b/test/ExecutionEngine/OrcJIT/test-global-ctors.ll new file mode 100644 index 0000000..bb00af6 --- /dev/null +++ b/test/ExecutionEngine/OrcJIT/test-global-ctors.ll @@ -0,0 +1,22 @@ +; RUN: %lli -use-orcmcjit %s > /dev/null +; XFAIL: darwin +@var = global i32 1, align 4 +@llvm.global_ctors = appending global [1 x { i32, void ()* }] [{ i32, void ()* } { i32 65535, void ()* @ctor_func }] +@llvm.global_dtors = appending global [1 x { i32, void ()* }] [{ i32, void ()* } { i32 65535, void ()* @dtor_func }] + +define i32 @main() nounwind { +entry: + %0 = load i32* @var, align 4 + ret i32 %0 +} + +define internal void @ctor_func() section ".text.startup" { +entry: + store i32 0, i32* @var, align 4 + ret void +} + +define internal void @dtor_func() section ".text.startup" { +entry: + ret void +} diff --git a/test/ExecutionEngine/OrcJIT/test-global-init-nonzero-sm-pic.ll b/test/ExecutionEngine/OrcJIT/test-global-init-nonzero-sm-pic.ll new file mode 100644 index 0000000..c8ef597 --- /dev/null +++ b/test/ExecutionEngine/OrcJIT/test-global-init-nonzero-sm-pic.ll @@ -0,0 +1,35 @@ +; RUN: %lli -use-orcmcjit -relocation-model=pic -code-model=small %s > /dev/null +; XFAIL: mips, aarch64, arm, i686, i386 + +@count = global i32 1, align 4 + +define i32 @main() nounwind uwtable { +entry: + %retval = alloca i32, align 4 + %i = alloca i32, align 4 + store i32 0, i32* %retval + store i32 0, i32* %i, align 4 + br label %for.cond + +for.cond: ; preds = %for.inc, %entry + %0 = load i32* %i, align 4 + %cmp = icmp slt i32 %0, 49 + br i1 %cmp, label %for.body, label %for.end + +for.body: ; preds = %for.cond + %1 = load i32* @count, align 4 + %inc = add nsw i32 %1, 1 + store i32 %inc, i32* @count, align 4 + br label %for.inc + +for.inc: ; preds = %for.body + %2 = load i32* %i, align 4 + %inc1 = add nsw i32 %2, 1 + store i32 %inc1, i32* %i, align 4 + br label %for.cond + +for.end: ; preds = %for.cond + %3 = load i32* @count, align 4 + %sub = sub nsw i32 %3, 50 + ret i32 %sub +} diff --git a/test/ExecutionEngine/test-global-init-nonzero.ll b/test/ExecutionEngine/OrcJIT/test-global-init-nonzero.ll index 749a485..46b721d 100644 --- a/test/ExecutionEngine/test-global-init-nonzero.ll +++ b/test/ExecutionEngine/OrcJIT/test-global-init-nonzero.ll @@ -1,4 +1,4 @@ -; RUN: %lli %s > /dev/null +; RUN: %lli -use-orcmcjit %s > /dev/null @count = global i32 1, align 4 diff --git a/test/ExecutionEngine/test-global.ll b/test/ExecutionEngine/OrcJIT/test-global.ll index 69e5455..5ece354 100644 --- a/test/ExecutionEngine/test-global.ll +++ b/test/ExecutionEngine/OrcJIT/test-global.ll @@ -1,4 +1,4 @@ -; RUN: %lli %s > /dev/null +; RUN: %lli -use-orcmcjit %s > /dev/null @count = global i32 0, align 4 diff --git a/test/ExecutionEngine/test-loadstore.ll b/test/ExecutionEngine/OrcJIT/test-loadstore.ll index 1797599..24ddd7a 100644 --- a/test/ExecutionEngine/test-loadstore.ll +++ b/test/ExecutionEngine/OrcJIT/test-loadstore.ll @@ -1,4 +1,4 @@ -; RUN: %lli %s > /dev/null +; RUN: %lli -use-orcmcjit %s > /dev/null define void @test(i8* %P, i16* %P.upgrd.1, i32* %P.upgrd.2, i64* %P.upgrd.3) { %V = load i8* %P ; <i8> [#uses=1] diff --git a/test/ExecutionEngine/test-local.ll b/test/ExecutionEngine/OrcJIT/test-local.ll index ec5ba16..b541650 100644 --- a/test/ExecutionEngine/test-local.ll +++ b/test/ExecutionEngine/OrcJIT/test-local.ll @@ -1,4 +1,4 @@ -; RUN: %lli %s > /dev/null +; RUN: %lli -use-orcmcjit %s > /dev/null define i32 @main() nounwind uwtable { entry: diff --git a/test/ExecutionEngine/test-logical.ll b/test/ExecutionEngine/OrcJIT/test-logical.ll index 05b381b..aa8e5de 100644 --- a/test/ExecutionEngine/test-logical.ll +++ b/test/ExecutionEngine/OrcJIT/test-logical.ll @@ -1,4 +1,4 @@ -; RUN: %lli %s > /dev/null +; RUN: %lli -use-orcmcjit %s > /dev/null define i32 @main() { %A = and i8 4, 8 ; <i8> [#uses=2] diff --git a/test/ExecutionEngine/test-loop.ll b/test/ExecutionEngine/OrcJIT/test-loop.ll index e951a14..5cb9353 100644 --- a/test/ExecutionEngine/test-loop.ll +++ b/test/ExecutionEngine/OrcJIT/test-loop.ll @@ -1,4 +1,4 @@ -; RUN: %lli %s > /dev/null +; RUN: %lli -use-orcmcjit %s > /dev/null define i32 @main() { ; <label>:0 diff --git a/test/ExecutionEngine/test-phi.ll b/test/ExecutionEngine/OrcJIT/test-phi.ll index c5bdfd5..880a916 100644 --- a/test/ExecutionEngine/test-phi.ll +++ b/test/ExecutionEngine/OrcJIT/test-phi.ll @@ -1,4 +1,4 @@ -; RUN: %lli %s > /dev/null +; RUN: %lli -use-orcmcjit %s > /dev/null ; test phi node @Y = global i32 6 ; <i32*> [#uses=1] diff --git a/test/ExecutionEngine/OrcJIT/test-ptr-reloc-sm-pic.ll b/test/ExecutionEngine/OrcJIT/test-ptr-reloc-sm-pic.ll new file mode 100644 index 0000000..d940adc --- /dev/null +++ b/test/ExecutionEngine/OrcJIT/test-ptr-reloc-sm-pic.ll @@ -0,0 +1,17 @@ +; RUN: %lli -use-orcmcjit -O0 -relocation-model=pic -code-model=small %s +; XFAIL: mips, aarch64, arm, i686, i386 + +@.str = private unnamed_addr constant [6 x i8] c"data1\00", align 1 +@ptr = global i8* getelementptr inbounds ([6 x i8]* @.str, i32 0, i32 0), align 4 +@.str1 = private unnamed_addr constant [6 x i8] c"data2\00", align 1 +@ptr2 = global i8* getelementptr inbounds ([6 x i8]* @.str1, i32 0, i32 0), align 4 + +define i32 @main(i32 %argc, i8** nocapture %argv) nounwind readonly { +entry: + %0 = load i8** @ptr, align 4 + %1 = load i8** @ptr2, align 4 + %cmp = icmp eq i8* %0, %1 + %. = zext i1 %cmp to i32 + ret i32 %. +} + diff --git a/test/ExecutionEngine/OrcJIT/test-ptr-reloc.ll b/test/ExecutionEngine/OrcJIT/test-ptr-reloc.ll new file mode 100644 index 0000000..95fa106 --- /dev/null +++ b/test/ExecutionEngine/OrcJIT/test-ptr-reloc.ll @@ -0,0 +1,16 @@ +; RUN: %lli -use-orcmcjit -O0 %s + +@.str = private unnamed_addr constant [6 x i8] c"data1\00", align 1 +@ptr = global i8* getelementptr inbounds ([6 x i8]* @.str, i32 0, i32 0), align 4 +@.str1 = private unnamed_addr constant [6 x i8] c"data2\00", align 1 +@ptr2 = global i8* getelementptr inbounds ([6 x i8]* @.str1, i32 0, i32 0), align 4 + +define i32 @main(i32 %argc, i8** nocapture %argv) nounwind readonly { +entry: + %0 = load i8** @ptr, align 4 + %1 = load i8** @ptr2, align 4 + %cmp = icmp eq i8* %0, %1 + %. = zext i1 %cmp to i32 + ret i32 %. +} + diff --git a/test/ExecutionEngine/test-ret.ll b/test/ExecutionEngine/OrcJIT/test-ret.ll index 025f53e..71ff452 100644 --- a/test/ExecutionEngine/test-ret.ll +++ b/test/ExecutionEngine/OrcJIT/test-ret.ll @@ -1,4 +1,4 @@ -; RUN: %lli %s > /dev/null +; RUN: %lli -use-orcmcjit %s > /dev/null ; test return instructions define void @test1() { diff --git a/test/ExecutionEngine/test-return.ll b/test/ExecutionEngine/OrcJIT/test-return.ll index d464a4b..07e74b0 100644 --- a/test/ExecutionEngine/test-return.ll +++ b/test/ExecutionEngine/OrcJIT/test-return.ll @@ -1,4 +1,4 @@ -; RUN: %lli %s > /dev/null +; RUN: %lli -use-orcmcjit %s > /dev/null define i32 @main() nounwind uwtable { entry: diff --git a/test/ExecutionEngine/test-setcond-fp.ll b/test/ExecutionEngine/OrcJIT/test-setcond-fp.ll index 68276e6..d708b90 100644 --- a/test/ExecutionEngine/test-setcond-fp.ll +++ b/test/ExecutionEngine/OrcJIT/test-setcond-fp.ll @@ -1,4 +1,4 @@ -; RUN: %lli %s > /dev/null +; RUN: %lli -use-orcmcjit %s > /dev/null define i32 @main() { diff --git a/test/ExecutionEngine/test-setcond-int.ll b/test/ExecutionEngine/OrcJIT/test-setcond-int.ll index 48dc021..b801d97 100644 --- a/test/ExecutionEngine/test-setcond-int.ll +++ b/test/ExecutionEngine/OrcJIT/test-setcond-int.ll @@ -1,4 +1,4 @@ -; RUN: %lli %s > /dev/null +; RUN: %lli -use-orcmcjit %s > /dev/null define i32 @main() { %int1 = add i32 0, 0 ; <i32> [#uses=6] diff --git a/test/ExecutionEngine/test-shift.ll b/test/ExecutionEngine/OrcJIT/test-shift.ll index 590e262..500987c 100644 --- a/test/ExecutionEngine/test-shift.ll +++ b/test/ExecutionEngine/OrcJIT/test-shift.ll @@ -1,4 +1,4 @@ -; RUN: %lli %s > /dev/null +; RUN: %lli -use-orcmcjit %s > /dev/null define i32 @main() { %shamt = add i8 0, 1 ; <i8> [#uses=8] diff --git a/test/ExecutionEngine/frem.ll b/test/ExecutionEngine/frem.ll index 7e0b606..ce83d20 100644 --- a/test/ExecutionEngine/frem.ll +++ b/test/ExecutionEngine/frem.ll @@ -8,12 +8,14 @@ @str = internal constant [18 x i8] c"Double value: %f\0A\00" declare i32 @printf(i8* nocapture, ...) nounwind +declare i32 @fflush(i8*) nounwind define i32 @main() { %flt = load float* @flt %float2 = frem float %flt, 5.0 %double1 = fpext float %float2 to double call i32 (i8*, ...)* @printf(i8* getelementptr ([18 x i8]* @str, i32 0, i64 0), double %double1) + call i32 @fflush(i8* null) ret i32 0 } diff --git a/test/ExecutionEngine/simplesttest.ll b/test/ExecutionEngine/simplesttest.ll deleted file mode 100644 index 85c1715..0000000 --- a/test/ExecutionEngine/simplesttest.ll +++ /dev/null @@ -1,6 +0,0 @@ -; RUN: %lli %s > /dev/null - -define i32 @main() { - ret i32 0 -} - |