diff options
| author | Andrew Kaylor <andrew.kaylor@intel.com> | 2013-08-19 21:08:35 +0000 |
|---|---|---|
| committer | Andrew Kaylor <andrew.kaylor@intel.com> | 2013-08-19 21:08:35 +0000 |
| commit | 93bf08705aaf008d6368aa1e4ff7f708d0e752d0 (patch) | |
| tree | 3aa7c9ae11bb9a8130101835921354a982141ef2 /llvm/test/ExecutionEngine/MCJIT/remote | |
| parent | 7da24888dda707fc191ab8c5bfdaa45a22c31185 (diff) | |
| download | bcm5719-llvm-93bf08705aaf008d6368aa1e4ff7f708d0e752d0.tar.gz bcm5719-llvm-93bf08705aaf008d6368aa1e4ff7f708d0e752d0.zip | |
Adding tests for PIC with MCJIT
llvm-svn: 188709
Diffstat (limited to 'llvm/test/ExecutionEngine/MCJIT/remote')
3 files changed, 88 insertions, 0 deletions
diff --git a/llvm/test/ExecutionEngine/MCJIT/remote/stubs-sm-pic.ll b/llvm/test/ExecutionEngine/MCJIT/remote/stubs-sm-pic.ll new file mode 100644 index 00000000000..106063cc62b --- /dev/null +++ b/llvm/test/ExecutionEngine/MCJIT/remote/stubs-sm-pic.ll @@ -0,0 +1,36 @@ +; RUN: %lli_mcjit -remote-mcjit -disable-lazy-compilation=false -relocation-model=pic -code-model=small %s +; XFAIL: x86_64, i386 + +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/llvm/test/ExecutionEngine/MCJIT/remote/test-global-init-nonzero-sm-pic.ll b/llvm/test/ExecutionEngine/MCJIT/remote/test-global-init-nonzero-sm-pic.ll new file mode 100644 index 00000000000..ef4d90a5389 --- /dev/null +++ b/llvm/test/ExecutionEngine/MCJIT/remote/test-global-init-nonzero-sm-pic.ll @@ -0,0 +1,35 @@ +; RUN: %lli_mcjit -remote-mcjit -relocation-model=pic -code-model=small %s > /dev/null +; XFAIL: x86_64, 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/llvm/test/ExecutionEngine/MCJIT/remote/test-ptr-reloc-sm-pic.ll b/llvm/test/ExecutionEngine/MCJIT/remote/test-ptr-reloc-sm-pic.ll new file mode 100644 index 00000000000..f9dbd999671 --- /dev/null +++ b/llvm/test/ExecutionEngine/MCJIT/remote/test-ptr-reloc-sm-pic.ll @@ -0,0 +1,17 @@ +; RUN: %lli_mcjit -remote-mcjit -O0 -relocation-model=pic -code-model=small %s +; XFAIL: x86_64, 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 %. +} + |

