llvm.org GIT mirror llvm / bb8cef5
- Added ExecutionEngine/MCJIT tests - Added HOST_ARCH to Makefile.config.in The HOST_ARCH will be used by MCJIT tests filter, because MCJIT supported only x86 and ARM architectures now. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157015 91177308-0d34-0410-b5e6-96231b3b80d8 Danil Malyshev 7 years ago
54 changed file(s) with 1295 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
111111 # Target operating system for which LLVM will compile for.
112112 TARGET_OS=@TARGET_OS@
113113
114 # Host hardware architecture
115 HOST_ARCH=@HOST_ARCH@
114116 # Target hardware architecture
115117 ARCH=@ARCH@
116118 TARGET_NATIVE_ARCH := $(ARCH)
387387 dnl Define a substitution, ARCH, for the target architecture
388388 AC_SUBST(ARCH,$llvm_cv_target_arch)
389389
390 dnl Determine what our host architecture.
391 dnl This will allow MCJIT regress tests runs only for supported
392 dnl platforms.
393 case $host in
394 i?86-*) host_arch="x86" ;;
395 amd64-* | x86_64-*) host_arch="x86_64" ;;
396 sparc*-*) host_arch="Sparc" ;;
397 powerpc*-*) host_arch="PowerPC" ;;
398 arm*-*) host_arch="ARM" ;;
399 mips-*) host_arch="Mips" ;;
400 mipsel-*) host_arch="Mips" ;;
401 xcore-*) host_arch="XCore" ;;
402 msp430-*) host_arch="MSP430" ;;
403 hexagon-*) host_arch="Hexagon" ;;
404 mblaze-*) host_arch="MBlaze" ;;
405 ptx-*) host_arch="PTX" ;;
406 *) host_arch="Unknown" ;;
407 esac
408
409 if test "$host_arch" = "Unknown" ; then
410 AC_MSG_WARN([Configuring LLVM for an unknown host archicture])
411 fi
412
413 AC_SUBST(HOST_ARCH,$host_arch)
414
390415 dnl Check for the endianness of the target
391416 AC_C_BIGENDIAN(AC_SUBST([ENDIAN],[big]),AC_SUBST([ENDIAN],[little]))
392417
673673 LLVM_ON_UNIX
674674 LLVM_ON_WIN32
675675 ARCH
676 HOST_ARCH
676677 ENDIAN
677678 GREP
678679 EGREP
39213922 ARCH=$llvm_cv_target_arch
39223923
39233924
3925 case $host in
3926 i?86-*) host_arch="x86" ;;
3927 amd64-* | x86_64-*) host_arch="x86_64" ;;
3928 sparc*-*) host_arch="Sparc" ;;
3929 powerpc*-*) host_arch="PowerPC" ;;
3930 arm*-*) host_arch="ARM" ;;
3931 mips-*) host_arch="Mips" ;;
3932 mipsel-*) host_arch="Mips" ;;
3933 xcore-*) host_arch="XCore" ;;
3934 msp430-*) host_arch="MSP430" ;;
3935 hexagon-*) host_arch="Hexagon" ;;
3936 mblaze-*) host_arch="MBlaze" ;;
3937 ptx-*) host_arch="PTX" ;;
3938 *) host_arch="Unknown" ;;
3939 esac
3940
3941 if test "$host_arch" = "Unknown" ; then
3942 { echo "$as_me:$LINENO: WARNING: Configuring LLVM for an unknown host archicture" >&5
3943 echo "$as_me: WARNING: Configuring LLVM for an unknown host archicture" >&2;}
3944 fi
3945
3946 HOST_ARCH=$host_arch
3947
3948
39243949
39253950
39263951 { echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5
1032310348 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
1032410349 lt_status=$lt_dlunknown
1032510350 cat > conftest.$ac_ext <
10326 #line 10327 "configure"
10351 #line 10352 "configure"
1032710352 #include "confdefs.h"
1032810353
1032910354 #if HAVE_DLFCN_H
2203522060 LLVM_ON_UNIX!$LLVM_ON_UNIX$ac_delim
2203622061 LLVM_ON_WIN32!$LLVM_ON_WIN32$ac_delim
2203722062 ARCH!$ARCH$ac_delim
22063 HOST_ARCH!$HOST_ARCH$ac_delim
2203822064 ENDIAN!$ENDIAN$ac_delim
2203922065 GREP!$GREP$ac_delim
2204022066 EGREP!$EGREP$ac_delim
2205922085 ENABLE_PTHREADS!$ENABLE_PTHREADS$ac_delim
2206022086 ENABLE_PIC!$ENABLE_PIC$ac_delim
2206122087 ENABLE_SHARED!$ENABLE_SHARED$ac_delim
22062 ENABLE_EMBED_STDCXX!$ENABLE_EMBED_STDCXX$ac_delim
2206322088 _ACEOF
2206422089
2206522090 if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
2210122126 ac_delim='%!_!# '
2210222127 for ac_last_try in false false false false false :; do
2210322128 cat >conf$$subs.sed <<_ACEOF
22129 ENABLE_EMBED_STDCXX!$ENABLE_EMBED_STDCXX$ac_delim
2210422130 ENABLE_TIMESTAMPS!$ENABLE_TIMESTAMPS$ac_delim
2210522131 TARGETS_TO_BUILD!$TARGETS_TO_BUILD$ac_delim
2210622132 LLVM_ENUM_TARGETS!$LLVM_ENUM_TARGETS$ac_delim
2219322219 LTLIBOBJS!$LTLIBOBJS$ac_delim
2219422220 _ACEOF
2219522221
22196 if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 90; then
22222 if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 91; then
2219722223 break
2219822224 elif $ac_last_try; then
2219922225 { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
4848 set(ENABLE_ASSERTIONS "0")
4949 endif()
5050
51 set(HOST_OS ${CMAKE_HOST_SYSTEM_NAME})
52 set(HOST_ARCH ${CMAKE_HOST_SYSTEM_PROCESSOR})
53
5154 configure_file(
5255 ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
5356 ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
0 ; RUN: %lli -use-mcjit %s > /dev/null
1
2 @.LC0 = internal global [10 x i8] c"argc: %d\0A\00" ; <[10 x i8]*> [#uses=1]
3
4 declare i32 @puts(i8*)
5
6 define void @getoptions(i32* %argc) {
7 bb0:
8 ret void
9 }
10
11 declare i32 @printf(i8*, ...)
12
13 define i32 @main(i32 %argc, i8** %argv) {
14 bb0:
15 call i32 (i8*, ...)* @printf( i8* getelementptr ([10 x i8]* @.LC0, i64 0, i64 0), i32 %argc ) ; :0 [#uses=0]
16 %cast224 = bitcast i8** %argv to i8* ; [#uses=1]
17 %local = alloca i8* ; [#uses=3]
18 store i8* %cast224, i8** %local
19 %cond226 = icmp sle i32 %argc, 0 ; [#uses=1]
20 br i1 %cond226, label %bb3, label %bb2
21 bb2: ; preds = %bb2, %bb0
22 %cann-indvar = phi i32 [ 0, %bb0 ], [ %add1-indvar, %bb2 ] ; [#uses=2]
23 %add1-indvar = add i32 %cann-indvar, 1 ; [#uses=2]
24 %cann-indvar-idxcast = sext i32 %cann-indvar to i64 ; [#uses=1]
25 %CT = bitcast i8** %local to i8*** ; [#uses=1]
26 %reg115 = load i8*** %CT ; [#uses=1]
27 %cast235 = getelementptr i8** %reg115, i64 %cann-indvar-idxcast ; [#uses=1]
28 %reg117 = load i8** %cast235 ; [#uses=1]
29 %reg236 = call i32 @puts( i8* %reg117 ) ; [#uses=0]
30 %cond239 = icmp slt i32 %add1-indvar, %argc ; [#uses=1]
31 br i1 %cond239, label %bb2, label %bb3
32 bb3: ; preds = %bb2, %bb0
33 %cast243 = bitcast i8** %local to i32* ; [#uses=1]
34 call void @getoptions( i32* %cast243 )
35 ret i32 0
36 }
0 ; RUN: %lli -use-mcjit %s > /dev/null
1
2 define i32 @foo(i32 %X, i32 %Y, double %A) {
3 %cond212 = fcmp une double %A, 1.000000e+00 ; [#uses=1]
4 %cast110 = zext i1 %cond212 to i32 ; [#uses=1]
5 ret i32 %cast110
6 }
7
8 define i32 @main() {
9 %reg212 = call i32 @foo( i32 0, i32 1, double 1.000000e+00 ) ; [#uses=1]
10 ret i32 %reg212
11 }
12
0 ; RUN: %lli -use-mcjit %s > /dev/null
1
2 define i32 @main() {
3 call i32 @mylog( i32 4 ) ; :1 [#uses=0]
4 ret i32 0
5 }
6
7 define internal i32 @mylog(i32 %num) {
8 bb0:
9 br label %bb2
10 bb2: ; preds = %bb2, %bb0
11 %reg112 = phi i32 [ 10, %bb2 ], [ 1, %bb0 ] ; [#uses=1]
12 %cann-indvar = phi i32 [ %cann-indvar, %bb2 ], [ 0, %bb0 ] ; [#uses=1]
13 %reg114 = add i32 %reg112, 1 ; [#uses=2]
14 %cond222 = icmp slt i32 %reg114, %num ; [#uses=1]
15 br i1 %cond222, label %bb2, label %bb3
16 bb3: ; preds = %bb2
17 ret i32 %reg114
18 }
19
0 ; RUN: %lli -use-mcjit %s > /dev/null
1
2 define i32 @main() {
3 ;
4 br label %Loop
5 Loop: ; preds = %Loop, %0
6 %X = phi i32 [ 0, %0 ], [ 1, %Loop ] ; [#uses=1]
7 br i1 true, label %Out, label %Loop
8 Out: ; preds = %Loop
9 ret i32 %X
10 }
11
0 ; RUN: %lli -use-mcjit %s > /dev/null
1
2 ; We were accidentally inverting the signedness of right shifts. Whoops.
3
4 define i32 @main() {
5 %X = ashr i32 -1, 16 ; [#uses=1]
6 %Y = ashr i32 %X, 16 ; [#uses=1]
7 %Z = add i32 %Y, 1 ; [#uses=1]
8 ret i32 %Z
9 }
10
0 ; RUN: %lli -use-mcjit %s > /dev/null
1
2 define i32 @main() {
3 %X = fadd double 0.000000e+00, 1.000000e+00 ; [#uses=1]
4 %Y = fsub double 0.000000e+00, 1.000000e+00 ; [#uses=2]
5 %Z = fcmp oeq double %X, %Y ; [#uses=0]
6 fadd double %Y, 0.000000e+00 ; :1 [#uses=0]
7 ret i32 0
8 }
9
0 ; RUN: %lli -use-mcjit %s > /dev/null
1
2 define i32 @bar(i8* %X) {
3 ; pointer should be 4 byte aligned!
4 %P = alloca double ; [#uses=1]
5 %R = ptrtoint double* %P to i32 ; [#uses=1]
6 %A = and i32 %R, 3 ; [#uses=1]
7 ret i32 %A
8 }
9
10 define i32 @main() {
11 %SP = alloca i8 ; [#uses=1]
12 %X = add i32 0, 0 ; [#uses=1]
13 alloca i8, i32 %X ; :1 [#uses=0]
14 call i32 @bar( i8* %SP ) ; :2 [#uses=1]
15 ret i32 %2
16 }
0 ; This testcase should return with an exit code of 1.
1 ;
2 ; RUN: not %lli -use-mcjit %s
3
4 @test = global i64 0 ; [#uses=1]
5
6 define internal i64 @test.upgrd.1() {
7 %tmp.0 = load i64* @test ; [#uses=1]
8 %tmp.1 = add i64 %tmp.0, 1 ; [#uses=1]
9 ret i64 %tmp.1
10 }
11
12 define i32 @main() {
13 %L = call i64 @test.upgrd.1( ) ; [#uses=1]
14 %I = trunc i64 %L to i32 ; [#uses=1]
15 ret i32 %I
16 }
17
18
0 ; RUN: %lli -use-mcjit %s test
1
2 declare i32 @puts(i8*)
3
4 define i32 @main(i32 %argc.1, i8** %argv.1) {
5 %tmp.5 = getelementptr i8** %argv.1, i64 1 ; [#uses=1]
6 %tmp.6 = load i8** %tmp.5 ; [#uses=1]
7 %tmp.0 = call i32 @puts( i8* %tmp.6 ) ; [#uses=0]
8 ret i32 0
9 }
10
0 ; RUN: %lli -use-mcjit %s > /dev/null
1
2 target datalayout = "e-p:32:32"
3
4 define i32 @main() {
5 entry:
6 br label %endif
7 then: ; No predecessors!
8 br label %endif
9 endif: ; preds = %then, %entry
10 %x = phi i32 [ 4, %entry ], [ 27, %then ] ; [#uses=0]
11 %result = phi i32 [ 32, %then ], [ 0, %entry ] ; [#uses=0]
12 ret i32 0
13 }
14
0 ; RUN: %lli -use-mcjit %s > /dev/null
1
2 ; Testcase distilled from 256.bzip2.
3
4 target datalayout = "e-p:32:32"
5
6 define i32 @main() {
7 entry:
8 br label %loopentry.0
9 loopentry.0: ; preds = %loopentry.0, %entry
10 %h.0 = phi i32 [ %tmp.2, %loopentry.0 ], [ -1, %entry ] ; [#uses=1]
11 %tmp.2 = add i32 %h.0, 1 ; [#uses=3]
12 %tmp.4 = icmp ne i32 %tmp.2, 0 ; [#uses=1]
13 br i1 %tmp.4, label %loopentry.0, label %loopentry.1
14 loopentry.1: ; preds = %loopentry.0
15 %h.1 = phi i32 [ %tmp.2, %loopentry.0 ] ; [#uses=1]
16 ret i32 %h.1
17 }
18
0 ; RUN: %lli -use-mcjit %s > /dev/null
1
2 ; Testcase distilled from 256.bzip2.
3
4 target datalayout = "e-p:32:32"
5
6 define i32 @main() {
7 entry:
8 %X = add i32 1, -1 ; [#uses=3]
9 br label %Next
10 Next: ; preds = %entry
11 %A = phi i32 [ %X, %entry ] ; [#uses=0]
12 %B = phi i32 [ %X, %entry ] ; [#uses=0]
13 %C = phi i32 [ %X, %entry ] ; [#uses=1]
14 ret i32 %C
15 }
16
0 ; RUN: %lli -use-mcjit %s > /dev/null
1
2 ; This testcase failed to work because two variable sized allocas confused the
3 ; local register allocator.
4
5 define i32 @main(i32 %X) {
6 %A = alloca i32, i32 %X ; [#uses=0]
7 %B = alloca float, i32 %X ; [#uses=0]
8 ret i32 0
9 }
10
0 ; RUN: %lli -use-mcjit %s > /dev/null
1
2 ;
3 ; Regression Test: EnvironmentTest.ll
4 ;
5 ; Description:
6 ; This is a regression test that verifies that the JIT passes the
7 ; environment to the main() function.
8 ;
9
10
11 declare i32 @strlen(i8*)
12
13 define i32 @main(i32 %argc.1, i8** %argv.1, i8** %envp.1) {
14 %tmp.2 = load i8** %envp.1 ; [#uses=1]
15 %tmp.3 = call i32 @strlen( i8* %tmp.2 ) ; [#uses=1]
16 %T = icmp eq i32 %tmp.3, 0 ; [#uses=1]
17 %R = zext i1 %T to i32 ; [#uses=1]
18 ret i32 %R
19 }
20
0 ; RUN: %lli -use-mcjit %s > /dev/null
1
2 ; This testcase exposes a bug in the local register allocator where it runs out
3 ; of registers (due to too many overlapping live ranges), but then attempts to
4 ; use the ESP register (which is not allocatable) to hold a value.
5
6 define i32 @main(i32 %A) {
7 ; ESP gets used again...
8 %Ap2 = alloca i32, i32 %A ; [#uses=11]
9 ; Produce lots of overlapping live ranges
10 %B = add i32 %A, 1 ; [#uses=1]
11 %C = add i32 %A, 2 ; [#uses=1]
12 %D = add i32 %A, 3 ; [#uses=1]
13 %E = add i32 %A, 4 ; [#uses=1]
14 %F = add i32 %A, 5 ; [#uses=1]
15 %G = add i32 %A, 6 ; [#uses=1]
16 %H = add i32 %A, 7 ; [#uses=1]
17 %I = add i32 %A, 8 ; [#uses=1]
18 %J = add i32 %A, 9 ; [#uses=1]
19 %K = add i32 %A, 10 ; [#uses=1]
20 ; Uses of all of the values
21 store i32 %A, i32* %Ap2
22 store i32 %B, i32* %Ap2
23 store i32 %C, i32* %Ap2
24 store i32 %D, i32* %Ap2
25 store i32 %E, i32* %Ap2
26 store i32 %F, i32* %Ap2
27 store i32 %G, i32* %Ap2
28 store i32 %H, i32* %Ap2
29 store i32 %I, i32* %Ap2
30 store i32 %J, i32* %Ap2
31 store i32 %K, i32* %Ap2
32 ret i32 0
33 }
0 ; RUN: %lli -use-mcjit %s > /dev/null
1
2 @A = global i32 0 ; [#uses=1]
3
4 define i32 @main() {
5 %Ret = call i32 @test( i1 true, i32 0 ) ; [#uses=1]
6 ret i32 %Ret
7 }
8
9 define i32 @test(i1 %c, i32 %A) {
10 br i1 %c, label %Taken1, label %NotTaken
11 Cont: ; preds = %Taken1, %NotTaken
12 %V = phi i32 [ 0, %NotTaken ], [ sub (i32 ptrtoint (i32* @A to i32), i32 1234), %Taken1 ] ; [#uses=0]
13 ret i32 0
14 NotTaken: ; preds = %0
15 br label %Cont
16 Taken1: ; preds = %0
17 %B = icmp eq i32 %A, 0 ; [#uses=1]
18 br i1 %B, label %Cont, label %ExitError
19 ExitError: ; preds = %Taken1
20 ret i32 12
21 }
22
0 ; PR672
1 ; RUN: %lli -use-mcjit %s
2 ; XFAIL: mcjit-ia32
3
4 define i32 @main() {
5 %f = bitcast i32 (i32, i32*, i32)* @check_tail to i32* ; [#uses=1]
6 %res = tail call fastcc i32 @check_tail( i32 10, i32* %f, i32 10 ) ; [#uses=1]
7 ret i32 %res
8 }
9
10 define fastcc i32 @check_tail(i32 %x, i32* %f, i32 %g) {
11 %tmp1 = icmp sgt i32 %x, 0 ; [#uses=1]
12 br i1 %tmp1, label %if-then, label %if-else
13 if-then: ; preds = %0
14 %fun_ptr = bitcast i32* %f to i32 (i32, i32*, i32)* ; [#uses=1]
15 %arg1 = add i32 %x, -1 ; [#uses=1]
16 %res = tail call fastcc i32 %fun_ptr( i32 %arg1, i32* %f, i32 %g ) ; [#uses=1]
17 ret i32 %res
18 if-else: ; preds = %0
19 ret i32 %x
20 }
21
0 ; RUN: %lli -use-mcjit -force-interpreter %s
1 ; PR1836
2
3 define i32 @main() {
4 entry:
5 %retval = alloca i32 ; [#uses=2]
6 %tmp = alloca i32 ; [#uses=2]
7 %x = alloca i75, align 16 ; [#uses=1]
8 %"alloca point" = bitcast i32 0 to i32 ; [#uses=0]
9 store i75 999, i75* %x, align 16
10 store i32 0, i32* %tmp, align 4
11 %tmp1 = load i32* %tmp, align 4 ; [#uses=1]
12 store i32 %tmp1, i32* %retval, align 4
13 br label %return
14
15 return: ; preds = %entry
16 %retval2 = load i32* %retval ; [#uses=1]
17 ret i32 %retval2
18 }
0 ; RUN: %lli -use-mcjit -force-interpreter=true %s | grep 1
1
2 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"
3 target triple = "i686-pc-linux-gnu"
4 @.str = internal constant [10 x i8] c"MSB = %d\0A\00" ; <[10 x i8]*> [#uses=1]
5
6 define i65 @foo(i65 %x) {
7 entry:
8 %x_addr = alloca i65 ; [#uses=2]
9 %retval = alloca i65 ; [#uses=2]
10 %tmp = alloca i65 ; [#uses=2]
11 %"alloca point" = bitcast i65 0 to i65 ; [#uses=0]
12 store i65 %x, i65* %x_addr
13 %tmp1 = load i65* %x_addr, align 4 ; [#uses=1]
14 %tmp2 = ashr i65 %tmp1, 65 ; [#uses=1]
15 store i65 %tmp2, i65* %tmp, align 4
16 %tmp3 = load i65* %tmp, align 4 ; [#uses=1]
17 store i65 %tmp3, i65* %retval, align 4
18 br label %return
19
20 return: ; preds = %entry
21 %retval4 = load i65* %retval ; [#uses=1]
22 ret i65 %retval4
23 }
24
25 define i32 @main() {
26 entry:
27 %retval = alloca i32 ; [#uses=1]
28 %iftmp.0 = alloca i32 ; [#uses=3]
29 %"alloca point" = bitcast i32 0 to i32 ; [#uses=0]
30 %tmp = call i65 @foo( i65 -9 ) ; [#uses=1]
31 %tmp1 = lshr i65 %tmp, 64 ; [#uses=1]
32 %tmp2 = xor i65 %tmp1, 1 ; [#uses=1]
33 %tmp3 = and i65 %tmp2, 1 ; [#uses=1]
34 %tmp34 = trunc i65 %tmp3 to i8 ; [#uses=1]
35 %toBool = icmp ne i8 %tmp34, 0 ; [#uses=1]
36 br i1 %toBool, label %cond_true, label %cond_false
37
38 cond_true: ; preds = %entry
39 store i32 0, i32* %iftmp.0, align 4
40 br label %cond_next
41
42 cond_false: ; preds = %entry
43 store i32 1, i32* %iftmp.0, align 4
44 br label %cond_next
45
46 cond_next: ; preds = %cond_false, %cond_true
47 %tmp5 = getelementptr [10 x i8]* @.str, i32 0, i32 0 ; [#uses=1]
48 %tmp6 = load i32* %iftmp.0, align 4 ; [#uses=1]
49 %tmp7 = call i32 (i8*, ...)* @printf( i8* noalias %tmp5, i32 %tmp6 ) nounwind ; [#uses=0]
50 br label %return
51
52 return: ; preds = %cond_next
53 store i32 0, i32* %retval, align 4
54 %retval8 = load i32* %retval ; [#uses=1]
55 ret i32 %retval8
56 }
57
58 declare i32 @printf(i8* noalias , ...) nounwind
0 ; RUN: %lli -use-mcjit -force-interpreter=true %s
1
2 define i32 @main() {
3 %a = add i32 0, undef
4 %b = fadd float 0.0, undef
5 %c = fadd double 0.0, undef
6 ret i32 0
7 }
0 ; RUN: %lli -use-mcjit -force-interpreter=true %s | grep 40091eb8
1 ;
2 define i32 @test(double %x) {
3 entry:
4 %x46.i = bitcast double %x to i64
5 %tmp343.i = lshr i64 %x46.i, 32
6 %tmp344.i = trunc i64 %tmp343.i to i32
7 ret i32 %tmp344.i
8 }
9
10 define i32 @main()
11 {
12 %res = call i32 @test(double 3.14)
13 %ptr = getelementptr [4 x i8]* @format, i32 0, i32 0
14 call i32 (i8*,...)* @printf(i8* %ptr, i32 %res)
15 ret i32 0
16 }
17
18 declare i32 @printf(i8*, ...)
19 @format = internal constant [4 x i8] c"%x\0A\00"
0 ; RUN: %lli -use-mcjit %s > /dev/null
1
2 @.LC0 = internal global [12 x i8] c"Hello World\00" ; <[12 x i8]*> [#uses=1]
3
4 declare i32 @puts(i8*)
5
6 define i32 @main() {
7 %reg210 = call i32 @puts( i8* getelementptr ([12 x i8]* @.LC0, i64 0, i64 0) ) ; [#uses=0]
8 ret i32 0
9 }
10
0 ; RUN: %lli -use-mcjit %s > /dev/null
1
2 @X = global i32 7 ; [#uses=0]
3 @msg = internal global [13 x i8] c"Hello World\0A\00" ; <[13 x i8]*> [#uses=1]
4
5 declare void @printf([13 x i8]*, ...)
6
7 define void @bar() {
8 call void ([13 x i8]*, ...)* @printf( [13 x i8]* @msg )
9 ret void
10 }
11
12 define i32 @main() {
13 call void @bar( )
14 ret i32 0
15 }
16
0 config.suffixes = ['.ll', '.c', '.cpp']
1
2 def getRoot(config):
3 if not config.parent:
4 return config
5 return getRoot(config.parent)
6
7 root = getRoot(config)
8
9 targets = set(root.targets_to_build.split())
10 if ('X86' in targets) | ('ARM' in targets):
11 config.unsupported = False
12 else:
13 config.unsupported = True
14
15 if root.host_arch not in ['x86', 'x86_64', 'ARM']:
16 config.unsupported = True
17
18 if root.host_os in ['Win32', 'Cygwin', 'MingW', 'Windows']:
19 config.unsupported = True
0 ; RUN: %lli -use-mcjit %s > /dev/null
1
2 define i32 @main() {
3 ret i32 0
4 }
5
0 ; RUN: %lli -use-mcjit %s > /dev/null
1
2 define i32 @bar() {
3 ret i32 0
4 }
5
6 define i32 @main() {
7 %r = call i32 @bar( ) ; [#uses=1]
8 ret i32 %r
9 }
10
0 ; RUN: %lli -use-mcjit -disable-lazy-compilation=false %s
1
2 define i32 @main() nounwind {
3 entry:
4 call void @lazily_compiled_address_is_consistent()
5 ret i32 0
6 }
7
8 ; Test PR3043: @test should have the same address before and after
9 ; it's JIT-compiled.
10 @funcPtr = common global i1 ()* null, align 4
11 @lcaic_failure = internal constant [46 x i8] c"@lazily_compiled_address_is_consistent failed\00"
12
13 define void @lazily_compiled_address_is_consistent() nounwind {
14 entry:
15 store i1 ()* @test, i1 ()** @funcPtr
16 %pass = tail call i1 @test() ; [#uses=1]
17 br i1 %pass, label %pass_block, label %fail_block
18 pass_block:
19 ret void
20 fail_block:
21 call i32 @puts(i8* getelementptr([46 x i8]* @lcaic_failure, i32 0, i32 0))
22 call void @exit(i32 1)
23 unreachable
24 }
25
26 define i1 @test() nounwind {
27 entry:
28 %tmp = load i1 ()** @funcPtr
29 %eq = icmp eq i1 ()* %tmp, @test
30 ret i1 %eq
31 }
32
33 declare i32 @puts(i8*) noreturn
34 declare void @exit(i32) noreturn
0 ; RUN: %lli -use-mcjit %s > /dev/null
1
2 define i32 @main() {
3 %A = add i8 0, 12 ; [#uses=1]
4 %B = sub i8 %A, 1 ; [#uses=2]
5 %C = mul i8 %B, %B ; [#uses=2]
6 %D = sdiv i8 %C, %C ; [#uses=2]
7 %E = srem i8 %D, %D ; [#uses=0]
8 %F = udiv i8 5, 6 ; [#uses=0]
9 %G = urem i8 6, 5 ; [#uses=0]
10 %A.upgrd.1 = add i16 0, 12 ; [#uses=1]
11 %B.upgrd.2 = sub i16 %A.upgrd.1, 1 ; [#uses=2]
12 %C.upgrd.3 = mul i16 %B.upgrd.2, %B.upgrd.2 ; [#uses=2]
13 %D.upgrd.4 = sdiv i16 %C.upgrd.3, %C.upgrd.3 ; [#uses=2]
14 %E.upgrd.5 = srem i16 %D.upgrd.4, %D.upgrd.4 ; [#uses=0]
15 %F.upgrd.6 = udiv i16 5, 6 ; [#uses=0]
16 %G.upgrd.7 = urem i32 6, 5 ; [#uses=0]
17 %A.upgrd.8 = add i32 0, 12 ; [#uses=1]
18 %B.upgrd.9 = sub i32 %A.upgrd.8, 1 ; [#uses=2]
19 %C.upgrd.10 = mul i32 %B.upgrd.9, %B.upgrd.9 ; [#uses=2]
20 %D.upgrd.11 = sdiv i32 %C.upgrd.10, %C.upgrd.10 ; [#uses=2]
21 %E.upgrd.12 = srem i32 %D.upgrd.11, %D.upgrd.11 ; [#uses=0]
22 %F.upgrd.13 = udiv i32 5, 6 ; [#uses=0]
23 %G1 = urem i32 6, 5 ; [#uses=0]
24 %A.upgrd.14 = add i64 0, 12 ; [#uses=1]
25 %B.upgrd.15 = sub i64 %A.upgrd.14, 1 ; [#uses=2]
26 %C.upgrd.16 = mul i64 %B.upgrd.15, %B.upgrd.15 ; [#uses=2]
27 %D.upgrd.17 = sdiv i64 %C.upgrd.16, %C.upgrd.16 ; [#uses=2]
28 %E.upgrd.18 = srem i64 %D.upgrd.17, %D.upgrd.17 ; [#uses=0]
29 %F.upgrd.19 = udiv i64 5, 6 ; [#uses=0]
30 %G.upgrd.20 = urem i64 6, 5 ; [#uses=0]
31 ret i32 0
32 }
33
0 ; RUN: %lli -use-mcjit %s > /dev/null
1
2 ; test unconditional branch
3 define i32 @main() {
4 br label %Test
5 Test: ; preds = %Test, %0
6 %X = icmp eq i32 0, 4 ; [#uses=1]
7 br i1 %X, label %Test, label %Label
8 Label: ; preds = %Test
9 ret i32 0
10 }
11
0 ; RUN: %lli -use-mcjit %s > /dev/null
1
2 define i32 @_Z14func_exit_codev() nounwind uwtable {
3 entry:
4 ret i32 0
5 }
6
7 define i32 @main() nounwind uwtable {
8 entry:
9 %retval = alloca i32, align 4
10 store i32 0, i32* %retval
11 %call = call i32 @_Z14func_exit_codev()
12 ret i32 %call
13 }
0 ; RUN: %lli -use-mcjit %s > /dev/null
1
2 declare void @exit(i32)
3
4 define i32 @test(i8 %C, i16 %S) {
5 %X = trunc i16 %S to i8 ; [#uses=1]
6 %Y = zext i8 %X to i32 ; [#uses=1]
7 ret i32 %Y
8 }
9
10 define void @FP(void (i32)* %F) {
11 %X = call i32 @test( i8 123, i16 1024 ) ; [#uses=1]
12 call void %F( i32 %X )
13 ret void
14 }
15
16 define i32 @main() {
17 call void @FP( void (i32)* @exit )
18 ret i32 1
19 }
20
0 ; RUN: %lli -use-mcjit %s > /dev/null
1
2 define i32 @foo() {
3 ret i32 0
4 }
5
6 define i32 @main() {
7 icmp ne i1 true, false ; :1 [#uses=0]
8 zext i1 true to i8 ; :2 [#uses=0]
9 zext i1 true to i8 ; :3 [#uses=0]
10 zext i1 true to i16 ; :4 [#uses=0]
11 zext i1 true to i16 ; :5 [#uses=0]
12 zext i1 true to i32 ; :6 [#uses=0]
13 zext i1 true to i32 ; :7 [#uses=0]
14 zext i1 true to i64 ; :8 [#uses=0]
15 zext i1 true to i64 ; :9 [#uses=0]
16 uitofp i1 true to float ; :10 [#uses=0]
17 uitofp i1 true to double ; :11 [#uses=0]
18 icmp ne i8 0, 0 ; :12 [#uses=0]
19 icmp ne i8 1, 0 ; :13 [#uses=0]
20 bitcast i8 0 to i8 ; :14 [#uses=0]
21 bitcast i8 -1 to i8 ; :15 [#uses=0]
22 sext i8 4 to i16 ; :16 [#uses=0]
23 sext i8 4 to i16 ; :17 [#uses=0]
24 sext i8 4 to i64 ; :18 [#uses=0]
25 sext i8 4 to i64 ; :19 [#uses=0]
26 sitofp i8 4 to float ; :20 [#uses=0]
27 sitofp i8 4 to double ; :21 [#uses=0]
28 icmp ne i8 0, 0 ; :22 [#uses=0]
29 icmp ne i8 1, 0 ; :23 [#uses=0]
30 bitcast i8 0 to i8 ; :24 [#uses=0]
31 bitcast i8 1 to i8 ; :25 [#uses=0]
32 zext i8 4 to i16 ; :26 [#uses=0]
33 zext i8 4 to i16 ; :27 [#uses=0]
34 zext i8 4 to i64 ; :28 [#uses=0]
35 zext i8 4 to i64 ; :29 [#uses=0]
36 uitofp i8 0 to float ; :30 [#uses=0]
37 uitofp i8 0 to double ; :31 [#uses=0]
38 icmp ne i16 1, 0 ; :32 [#uses=0]
39 trunc i16 -1 to i8 ; :33 [#uses=0]
40 trunc i16 255 to i8 ; :34 [#uses=0]
41 bitcast i16 0 to i16 ; :35 [#uses=0]
42 bitcast i16 0 to i16 ; :36 [#uses=0]
43 sext i16 0 to i64 ; :37 [#uses=0]
44 sext i16 0 to i64 ; :38 [#uses=0]
45 sitofp i16 0 to float ; :39 [#uses=0]
46 sitofp i16 0 to double ; :40 [#uses=0]
47 icmp ne i16 1, 0 ; :41 [#uses=0]
48 trunc i16 1 to i8 ; :42 [#uses=0]
49 trunc i16 255 to i8 ; :43 [#uses=0]
50 bitcast i16 0 to i16 ; :44 [#uses=0]
51 bitcast i16 0 to i16 ; :45 [#uses=0]
52 zext i16 0 to i64 ; :46 [#uses=0]
53 zext i16 0 to i64 ; :47 [#uses=0]
54 uitofp i16 0 to float ; :48 [#uses=0]
55 uitofp i16 0 to double ; :49 [#uses=0]
56 icmp ne i32 6, 0 ; :50 [#uses=0]
57 trunc i32 -6 to i8 ; :51 [#uses=0]
58 trunc i32 6 to i8 ; :52 [#uses=0]
59 trunc i32 6 to i16 ; :53 [#uses=0]
60 bitcast i32 0 to i32 ; :54 [#uses=0]
61 sext i32 0 to i64 ; :55 [#uses=0]
62 sext i32 0 to i64 ; :56 [#uses=0]
63 sitofp i32 0 to float ; :57 [#uses=0]
64 sitofp i32 0 to double ; :58 [#uses=0]
65 icmp ne i32 6, 0 ; :59 [#uses=0]
66 trunc i32 7 to i8 ; :60 [#uses=0]
67 trunc i32 8 to i8 ; :61 [#uses=0]
68 trunc i32 9 to i16 ; :62 [#uses=0]
69 bitcast i32 10 to i32 ; :63 [#uses=0]
70 zext i32 0 to i64 ; :64 [#uses=0]
71 zext i32 0 to i64 ; :65 [#uses=0]
72 uitofp i32 0 to float ; :66 [#uses=0]
73 uitofp i32 0 to double ; :67 [#uses=0]
74 icmp ne i64 0, 0 ; :68 [#uses=0]
75 trunc i64 0 to i8 ; :69 [#uses=0]
76 trunc i64 0 to i8 ; :70 [#uses=0]
77 trunc i64 0 to i16 ; :71 [#uses=0]
78 trunc i64 0 to i16 ; :72 [#uses=0]
79 trunc i64 0 to i32 ; :73 [#uses=0]
80 trunc i64 0 to i32 ; :74 [#uses=0]
81 bitcast i64 0 to i64 ; :75 [#uses=0]
82 bitcast i64 0 to i64 ; :76 [#uses=0]
83 sitofp i64 0 to float ; :77 [#uses=0]
84 sitofp i64 0 to double ; :78 [#uses=0]
85 icmp ne i64 1, 0 ; :79 [#uses=0]
86 trunc i64 1 to i8 ; :80 [#uses=0]
87 trunc i64 1 to i8 ; :81 [#uses=0]
88 trunc i64 1 to i16 ; :82 [#uses=0]
89 trunc i64 1 to i16 ; :83 [#uses=0]
90 trunc i64 1 to i32 ; :84 [#uses=0]
91 trunc i64 1 to i32 ; :85 [#uses=0]
92 bitcast i64 1 to i64 ; :86 [#uses=0]
93 bitcast i64 1 to i64 ; :87 [#uses=0]
94 uitofp i64 1 to float ; :88 [#uses=0]
95 uitofp i64 0 to double ; :89 [#uses=0]
96 bitcast float 0.000000e+00 to float ; :90 [#uses=0]
97 fpext float 0.000000e+00 to double ; :91 [#uses=0]
98 fptosi double 0.000000e+00 to i8 ; :92 [#uses=0]
99 fptoui double 0.000000e+00 to i8 ; :93 [#uses=0]
100 fptosi double 0.000000e+00 to i16 ; :94 [#uses=0]
101 fptoui double 0.000000e+00 to i16 ; :95 [#uses=0]
102 fptosi double 0.000000e+00 to i32 ; :96 [#uses=0]
103 fptoui double 0.000000e+00 to i32 ; :97 [#uses=0]
104 fptosi double 0.000000e+00 to i64 ; :98 [#uses=0]
105 fptrunc double 0.000000e+00 to float ; :99 [#uses=0]
106 bitcast double 0.000000e+00 to double ; :100 [#uses=0]
107 ret i32 0
108 }
0 ; RUN: %lli -use-mcjit -O0 -disable-lazy-compilation=false %s
1
2 ; The intention of this test is to verify that symbols mapped to COMMON in ELF
3 ; work as expected.
4 ;
5 ; Compiled from this C code:
6 ;
7 ; int zero_int;
8 ; double zero_double;
9 ; int zero_arr[10];
10 ;
11 ; int main()
12 ; {
13 ; zero_arr[zero_int + 5] = 40;
14 ;
15 ; if (zero_double < 1.0)
16 ; zero_arr[zero_int + 2] = 70;
17 ;
18 ; for (int i = 1; i < 10; ++i) {
19 ; zero_arr[i] = zero_arr[i - 1] + zero_arr[i];
20 ; }
21 ; return zero_arr[9] == 110 ? 0 : -1;
22 ; }
23
24 @zero_int = common global i32 0, align 4
25 @zero_arr = common global [10 x i32] zeroinitializer, align 16
26 @zero_double = common global double 0.000000e+00, align 8
27
28 define i32 @main() nounwind {
29 entry:
30 %retval = alloca i32, align 4
31 %i = alloca i32, align 4
32 store i32 0, i32* %retval
33 %0 = load i32* @zero_int, align 4
34 %add = add nsw i32 %0, 5
35 %idxprom = sext i32 %add to i64
36 %arrayidx = getelementptr inbounds [10 x i32]* @zero_arr, i32 0, i64 %idxprom
37 store i32 40, i32* %arrayidx, align 4
38 %1 = load double* @zero_double, align 8
39 %cmp = fcmp olt double %1, 1.000000e+00
40 br i1 %cmp, label %if.then, label %if.end
41
42 if.then: ; preds = %entry
43 %2 = load i32* @zero_int, align 4
44 %add1 = add nsw i32 %2, 2
45 %idxprom2 = sext i32 %add1 to i64
46 %arrayidx3 = getelementptr inbounds [10 x i32]* @zero_arr, i32 0, i64 %idxprom2
47 store i32 70, i32* %arrayidx3, align 4
48 br label %if.end
49
50 if.end: ; preds = %if.then, %entry
51 store i32 1, i32* %i, align 4
52 br label %for.cond
53
54 for.cond: ; preds = %for.inc, %if.end
55 %3 = load i32* %i, align 4
56 %cmp4 = icmp slt i32 %3, 10
57 br i1 %cmp4, label %for.body, label %for.end
58
59 for.body: ; preds = %for.cond
60 %4 = load i32* %i, align 4
61 %sub = sub nsw i32 %4, 1
62 %idxprom5 = sext i32 %sub to i64
63 %arrayidx6 = getelementptr inbounds [10 x i32]* @zero_arr, i32 0, i64 %idxprom5
64 %5 = load i32* %arrayidx6, align 4
65 %6 = load i32* %i, align 4
66 %idxprom7 = sext i32 %6 to i64
67 %arrayidx8 = getelementptr inbounds [10 x i32]* @zero_arr, i32 0, i64 %idxprom7
68 %7 = load i32* %arrayidx8, align 4
69 %add9 = add nsw i32 %5, %7
70 %8 = load i32* %i, align 4
71 %idxprom10 = sext i32 %8 to i64
72 %arrayidx11 = getelementptr inbounds [10 x i32]* @zero_arr, i32 0, i64 %idxprom10
73 store i32 %add9, i32* %arrayidx11, align 4
74 br label %for.inc
75
76 for.inc: ; preds = %for.body
77 %9 = load i32* %i, align 4
78 %inc = add nsw i32 %9, 1
79 store i32 %inc, i32* %i, align 4
80 br label %for.cond
81
82 for.end: ; preds = %for.cond
83 %10 = load i32* getelementptr inbounds ([10 x i32]* @zero_arr, i32 0, i64 9), align 4
84 %cmp12 = icmp eq i32 %10, 110
85 %cond = select i1 %cmp12, i32 0, i32 -1
86 ret i32 %cond
87 }
0 ; RUN: %lli -use-mcjit %s > /dev/null
1
2 ; This tests to make sure that we can evaluate weird constant expressions
3
4 @A = global i32 5 ; [#uses=1]
5 @B = global i32 6 ; [#uses=1]
6
7 define i32 @main() {
8 %A = or i1 false, icmp slt (i32* @A, i32* @B) ; [#uses=0]
9 ret i32 0
10 }
11
0 ; RUN: %lli -use-mcjit %s > /dev/null
1
2 define double @test(double* %DP, double %Arg) {
3 %D = load double* %DP ; [#uses=1]
4 %V = fadd double %D, 1.000000e+00 ; [#uses=2]
5 %W = fsub double %V, %V ; [#uses=3]
6 %X = fmul double %W, %W ; [#uses=2]
7 %Y = fdiv double %X, %X ; [#uses=2]
8 %Q = fadd double %Y, %Arg ; [#uses=1]
9 %R = bitcast double %Q to double ; [#uses=1]
10 store double %Q, double* %DP
11 ret double %Y
12 }
13
14 define i32 @main() {
15 %X = alloca double ; [#uses=2]
16 store double 0.000000e+00, double* %X
17 call double @test( double* %X, double 2.000000e+00 ) ; :1 [#uses=0]
18 ret i32 0
19 }
20
0 ; RUN: %lli -use-mcjit %s > /dev/null
1
2 define double @test(double* %DP, double %Arg) {
3 %D = load double* %DP ; [#uses=1]
4 %V = fadd double %D, 1.000000e+00 ; [#uses=2]
5 %W = fsub double %V, %V ; [#uses=3]
6 %X = fmul double %W, %W ; [#uses=2]
7 %Y = fdiv double %X, %X ; [#uses=2]
8 %Z = frem double %Y, %Y ; [#uses=3]
9 %Z1 = fdiv double %Z, %W ; [#uses=0]
10 %Q = fadd double %Z, %Arg ; [#uses=1]
11 %R = bitcast double %Q to double ; [#uses=1]
12 store double %R, double* %DP
13 ret double %Z
14 }
15
16 define i32 @main() {
17 %X = alloca double ; [#uses=2]
18 store double 0.000000e+00, double* %X
19 call double @test( double* %X, double 2.000000e+00 ) ; :1 [#uses=0]
20 ret i32 0
21 }
22
0 ; RUN: %lli -use-mcjit %s > /dev/null
1
2 @count = global i32 1, align 4
3
4 define i32 @main() nounwind uwtable {
5 entry:
6 %retval = alloca i32, align 4
7 %i = alloca i32, align 4
8 store i32 0, i32* %retval
9 store i32 0, i32* %i, align 4
10 br label %for.cond
11
12 for.cond: ; preds = %for.inc, %entry
13 %0 = load i32* %i, align 4
14 %cmp = icmp slt i32 %0, 49
15 br i1 %cmp, label %for.body, label %for.end
16
17 for.body: ; preds = %for.cond
18 %1 = load i32* @count, align 4
19 %inc = add nsw i32 %1, 1
20 store i32 %inc, i32* @count, align 4
21 br label %for.inc
22
23 for.inc: ; preds = %for.body
24 %2 = load i32* %i, align 4
25 %inc1 = add nsw i32 %2, 1
26 store i32 %inc1, i32* %i, align 4
27 br label %for.cond
28
29 for.end: ; preds = %for.cond
30 %3 = load i32* @count, align 4
31 %sub = sub nsw i32 %3, 50
32 ret i32 %sub
33 }
0 ; RUN: %lli -use-mcjit %s > /dev/null
1
2 @count = global i32 0, align 4
3
4 define i32 @main() nounwind uwtable {
5 entry:
6 %retval = alloca i32, align 4
7 %i = alloca i32, align 4
8 store i32 0, i32* %retval
9 store i32 0, i32* %i, align 4
10 br label %for.cond
11
12 for.cond: ; preds = %for.inc, %entry
13 %0 = load i32* %i, align 4
14 %cmp = icmp slt i32 %0, 50
15 br i1 %cmp, label %for.body, label %for.end
16
17 for.body: ; preds = %for.cond
18 %1 = load i32* @count, align 4
19 %inc = add nsw i32 %1, 1
20 store i32 %inc, i32* @count, align 4
21 br label %for.inc
22
23 for.inc: ; preds = %for.body
24 %2 = load i32* %i, align 4
25 %inc1 = add nsw i32 %2, 1
26 store i32 %inc1, i32* %i, align 4
27 br label %for.cond
28
29 for.end: ; preds = %for.cond
30 %3 = load i32* @count, align 4
31 %sub = sub nsw i32 %3, 50
32 ret i32 %sub
33 }
0 ; RUN: %lli -use-mcjit %s > /dev/null
1
2 define void @test(i8* %P, i16* %P.upgrd.1, i32* %P.upgrd.2, i64* %P.upgrd.3) {
3 %V = load i8* %P ; [#uses=1]
4 store i8 %V, i8* %P
5 %V.upgrd.4 = load i16* %P.upgrd.1 ; [#uses=1]
6 store i16 %V.upgrd.4, i16* %P.upgrd.1
7 %V.upgrd.5 = load i32* %P.upgrd.2 ; [#uses=1]
8 store i32 %V.upgrd.5, i32* %P.upgrd.2
9 %V.upgrd.6 = load i64* %P.upgrd.3 ; [#uses=1]
10 store i64 %V.upgrd.6, i64* %P.upgrd.3
11 ret void
12 }
13
14 define i32 @varalloca(i32 %Size) {
15 ;; Variable sized alloca
16 %X = alloca i32, i32 %Size ; [#uses=2]
17 store i32 %Size, i32* %X
18 %Y = load i32* %X ; [#uses=1]
19 ret i32 %Y
20 }
21
22 define i32 @main() {
23 %A = alloca i8 ; [#uses=1]
24 %B = alloca i16 ; [#uses=1]
25 %C = alloca i32 ; [#uses=1]
26 %D = alloca i64 ; [#uses=1]
27 call void @test( i8* %A, i16* %B, i32* %C, i64* %D )
28 call i32 @varalloca( i32 7 ) ; :1 [#uses=0]
29 ret i32 0
30 }
0 ; RUN: %lli -use-mcjit %s > /dev/null
1
2 define i32 @main() nounwind uwtable {
3 entry:
4 %retval = alloca i32, align 4
5 %count = alloca i32, align 4
6 %i = alloca i32, align 4
7 store i32 0, i32* %retval
8 store i32 0, i32* %count, align 4
9 store i32 0, i32* %i, align 4
10 br label %for.cond
11
12 for.cond: ; preds = %for.inc, %entry
13 %0 = load i32* %i, align 4
14 %cmp = icmp slt i32 %0, 50
15 br i1 %cmp, label %for.body, label %for.end
16
17 for.body: ; preds = %for.cond
18 %1 = load i32* %count, align 4
19 %inc = add nsw i32 %1, 1
20 store i32 %inc, i32* %count, align 4
21 br label %for.inc
22
23 for.inc: ; preds = %for.body
24 %2 = load i32* %i, align 4
25 %inc1 = add nsw i32 %2, 1
26 store i32 %inc1, i32* %i, align 4
27 br label %for.cond
28
29 for.end: ; preds = %for.cond
30 %3 = load i32* %count, align 4
31 %sub = sub nsw i32 %3, 50
32 ret i32 %sub
33 }
0 ; RUN: %lli -use-mcjit %s > /dev/null
1
2 define i32 @main() {
3 %A = and i8 4, 8 ; [#uses=2]
4 %B = or i8 %A, 7 ; [#uses=1]
5 %C = xor i8 %B, %A ; [#uses=0]
6 %A.upgrd.1 = and i16 4, 8 ; [#uses=2]
7 %B.upgrd.2 = or i16 %A.upgrd.1, 7 ; [#uses=1]
8 %C.upgrd.3 = xor i16 %B.upgrd.2, %A.upgrd.1 ; [#uses=0]
9 %A.upgrd.4 = and i32 4, 8 ; [#uses=2]
10 %B.upgrd.5 = or i32 %A.upgrd.4, 7 ; [#uses=1]
11 %C.upgrd.6 = xor i32 %B.upgrd.5, %A.upgrd.4 ; [#uses=0]
12 %A.upgrd.7 = and i64 4, 8 ; [#uses=2]
13 %B.upgrd.8 = or i64 %A.upgrd.7, 7 ; [#uses=1]
14 %C.upgrd.9 = xor i64 %B.upgrd.8, %A.upgrd.7 ; [#uses=0]
15 ret i32 0
16 }
17
0 ; RUN: %lli -use-mcjit %s > /dev/null
1
2 define i32 @main() {
3 ;
4 br label %Loop
5 Loop: ; preds = %Loop, %0
6 %I = phi i32 [ 0, %0 ], [ %i2, %Loop ] ; [#uses=1]
7 %i2 = add i32 %I, 1 ; [#uses=2]
8 %C = icmp eq i32 %i2, 10 ; [#uses=1]
9 br i1 %C, label %Out, label %Loop
10 Out: ; preds = %Loop
11 ret i32 0
12 }
13
0 ; RUN: %lli -use-mcjit %s > /dev/null
1
2 ; test phi node
3 @Y = global i32 6 ; [#uses=1]
4
5 define void @blah(i32* %X) {
6 ;
7 br label %T
8 T: ; preds = %Dead, %0
9 phi i32* [ %X, %0 ], [ @Y, %Dead ] ; :1 [#uses=0]
10 ret void
11 Dead: ; No predecessors!
12 br label %T
13 }
14
15 define i32 @test(i1 %C) {
16 ;
17 br i1 %C, label %T, label %T
18 T: ; preds = %0, %0
19 %X = phi i32 [ 123, %0 ], [ 123, %0 ] ; [#uses=1]
20 ret i32 %X
21 }
22
23 define i32 @main() {
24 ;
25 br label %Test
26 Test: ; preds = %Dead, %0
27 %X = phi i32 [ 0, %0 ], [ %Y, %Dead ] ; [#uses=1]
28 ret i32 %X
29 Dead: ; No predecessors!
30 %Y = ashr i32 12, 4 ; [#uses=1]
31 br label %Test
32 }
33
0 ; RUN: %lli -use-mcjit %s > /dev/null
1
2 ; test return instructions
3 define void @test1() {
4 ret void
5 }
6
7 define i8 @test2() {
8 ret i8 1
9 }
10
11 define i8 @test3() {
12 ret i8 1
13 }
14
15 define i16 @test4() {
16 ret i16 -1
17 }
18
19 define i16 @test5() {
20 ret i16 -1
21 }
22
23 define i32 @main() {
24 ret i32 0
25 }
26
27 define i32 @test6() {
28 ret i32 4
29 }
30
31 define i64 @test7() {
32 ret i64 0
33 }
34
35 define i64 @test8() {
36 ret i64 0
37 }
38
39 define float @test9() {
40 ret float 1.000000e+00
41 }
42
43 define double @test10() {
44 ret double 2.000000e+00
45 }
0 ; RUN: %lli -use-mcjit %s > /dev/null
1
2 define i32 @main() nounwind uwtable {
3 entry:
4 %retval = alloca i32, align 4
5 store i32 0, i32* %retval
6 ret i32 0
7 }
0 ; RUN: %lli -use-mcjit %s > /dev/null
1
2
3 define i32 @main() {
4 %double1 = fadd double 0.000000e+00, 0.000000e+00 ; [#uses=6]
5 %double2 = fadd double 0.000000e+00, 0.000000e+00 ; [#uses=6]
6 %float1 = fadd float 0.000000e+00, 0.000000e+00 ; [#uses=6]
7 %float2 = fadd float 0.000000e+00, 0.000000e+00 ; [#uses=6]
8 %test49 = fcmp oeq float %float1, %float2 ; [#uses=0]
9 %test50 = fcmp oge float %float1, %float2 ; [#uses=0]
10 %test51 = fcmp ogt float %float1, %float2 ; [#uses=0]
11 %test52 = fcmp ole float %float1, %float2 ; [#uses=0]
12 %test53 = fcmp olt float %float1, %float2 ; [#uses=0]
13 %test54 = fcmp une float %float1, %float2 ; [#uses=0]
14 %test55 = fcmp oeq double %double1, %double2 ; [#uses=0]
15 %test56 = fcmp oge double %double1, %double2 ; [#uses=0]
16 %test57 = fcmp ogt double %double1, %double2 ; [#uses=0]
17 %test58 = fcmp ole double %double1, %double2 ; [#uses=0]
18 %test59 = fcmp olt double %double1, %double2 ; [#uses=0]
19 %test60 = fcmp une double %double1, %double2 ; [#uses=0]
20 ret i32 0
21 }
22
23
0 ; RUN: %lli -use-mcjit %s > /dev/null
1
2 define i32 @main() {
3 %int1 = add i32 0, 0 ; [#uses=6]
4 %int2 = add i32 0, 0 ; [#uses=6]
5 %long1 = add i64 0, 0 ; [#uses=6]
6 %long2 = add i64 0, 0 ; [#uses=6]
7 %sbyte1 = add i8 0, 0 ; [#uses=6]
8 %sbyte2 = add i8 0, 0 ; [#uses=6]
9 %short1 = add i16 0, 0 ; [#uses=6]
10 %short2 = add i16 0, 0 ; [#uses=6]
11 %ubyte1 = add i8 0, 0 ; [#uses=6]
12 %ubyte2 = add i8 0, 0 ; [#uses=6]
13 %uint1 = add i32 0, 0 ; [#uses=6]
14 %uint2 = add i32 0, 0 ; [#uses=6]
15 %ulong1 = add i64 0, 0 ; [#uses=6]
16 %ulong2 = add i64 0, 0 ; [#uses=6]
17 %ushort1 = add i16 0, 0 ; [#uses=6]
18 %ushort2 = add i16 0, 0 ; [#uses=6]
19 %test1 = icmp eq i8 %ubyte1, %ubyte2 ; [#uses=0]
20 %test2 = icmp uge i8 %ubyte1, %ubyte2 ; [#uses=0]
21 %test3 = icmp ugt i8 %ubyte1, %ubyte2 ; [#uses=0]
22 %test4 = icmp ule i8 %ubyte1, %ubyte2 ; [#uses=0]
23 %test5 = icmp ult i8 %ubyte1, %ubyte2 ; [#uses=0]
24 %test6 = icmp ne i8 %ubyte1, %ubyte2 ; [#uses=0]
25 %test7 = icmp eq i16 %ushort1, %ushort2 ; [#uses=0]
26 %test8 = icmp uge i16 %ushort1, %ushort2 ; [#uses=0]
27 %test9 = icmp ugt i16 %ushort1, %ushort2 ; [#uses=0]
28 %test10 = icmp ule i16 %ushort1, %ushort2 ; [#uses=0]
29 %test11 = icmp ult i16 %ushort1, %ushort2 ; [#uses=0]
30 %test12 = icmp ne i16 %ushort1, %ushort2 ; [#uses=0]
31 %test13 = icmp eq i32 %uint1, %uint2 ; [#uses=0]
32 %test14 = icmp uge i32 %uint1, %uint2 ; [#uses=0]
33 %test15 = icmp ugt i32 %uint1, %uint2 ; [#uses=0]
34 %test16 = icmp ule i32 %uint1, %uint2 ; [#uses=0]
35 %test17 = icmp ult i32 %uint1, %uint2 ; [#uses=0]
36 %test18 = icmp ne i32 %uint1, %uint2 ; [#uses=0]
37 %test19 = icmp eq i64 %ulong1, %ulong2 ; [#uses=0]
38 %test20 = icmp uge i64 %ulong1, %ulong2 ; [#uses=0]
39 %test21 = icmp ugt i64 %ulong1, %ulong2 ; [#uses=0]
40 %test22 = icmp ule i64 %ulong1, %ulong2 ; [#uses=0]
41 %test23 = icmp ult i64 %ulong1, %ulong2 ; [#uses=0]
42 %test24 = icmp ne i64 %ulong1, %ulong2 ; [#uses=0]
43 %test25 = icmp eq i8 %sbyte1, %sbyte2 ; [#uses=0]
44 %test26 = icmp sge i8 %sbyte1, %sbyte2 ; [#uses=0]
45 %test27 = icmp sgt i8 %sbyte1, %sbyte2 ; [#uses=0]
46 %test28 = icmp sle i8 %sbyte1, %sbyte2 ; [#uses=0]
47 %test29 = icmp slt i8 %sbyte1, %sbyte2 ; [#uses=0]
48 %test30 = icmp ne i8 %sbyte1, %sbyte2 ; [#uses=0]
49 %test31 = icmp eq i16 %short1, %short2 ; [#uses=0]
50 %test32 = icmp sge i16 %short1, %short2 ; [#uses=0]
51 %test33 = icmp sgt i16 %short1, %short2 ; [#uses=0]
52 %test34 = icmp sle i16 %short1, %short2 ; [#uses=0]
53 %test35 = icmp slt i16 %short1, %short2 ; [#uses=0]
54 %test36 = icmp ne i16 %short1, %short2 ; [#uses=0]
55 %test37 = icmp eq i32 %int1, %int2 ; [#uses=0]
56 %test38 = icmp sge i32 %int1, %int2 ; [#uses=0]
57 %test39 = icmp sgt i32 %int1, %int2 ; [#uses=0]
58 %test40 = icmp sle i32 %int1, %int2 ; [#uses=0]
59 %test41 = icmp slt i32 %int1, %int2 ; [#uses=0]
60 %test42 = icmp ne i32 %int1, %int2 ; [#uses=0]
61 %test43 = icmp eq i64 %long1, %long2 ; [#uses=0]
62 %test44 = icmp sge i64 %long1, %long2 ; [#uses=0]
63 %test45 = icmp sgt i64 %long1, %long2 ; [#uses=0]
64 %test46 = icmp sle i64 %long1, %long2 ; [#uses=0]
65 %test47 = icmp slt i64 %long1, %long2 ; [#uses=0]
66 %test48 = icmp ne i64 %long1, %long2 ; [#uses=0]
67 ret i32 0
68 }
0 ; RUN: %lli -use-mcjit %s > /dev/null
1
2 define i32 @main() {
3 %shamt = add i8 0, 1 ; [#uses=8]
4 %shift.upgrd.1 = zext i8 %shamt to i32 ; [#uses=1]
5 %t1.s = shl i32 1, %shift.upgrd.1 ; [#uses=0]
6 %t2.s = shl i32 1, 4 ; [#uses=0]
7 %shift.upgrd.2 = zext i8 %shamt to i32 ; [#uses=1]
8 %t1 = shl i32 1, %shift.upgrd.2 ; [#uses=0]
9 %t2 = shl i32 1, 5 ; [#uses=0]
10 %t2.s.upgrd.3 = shl i64 1, 4 ; [#uses=0]
11 %t2.upgrd.4 = shl i64 1, 5 ; [#uses=0]
12 %shift.upgrd.5 = zext i8 %shamt to i32 ; [#uses=1]
13 %tr1.s = ashr i32 1, %shift.upgrd.5 ; [#uses=0]
14 %tr2.s = ashr i32 1, 4 ; [#uses=0]
15 %shift.upgrd.6 = zext i8 %shamt to i32 ; [#uses=1]
16 %tr1 = lshr i32 1, %shift.upgrd.6 ; [#uses=0]
17 %tr2 = lshr i32 1, 5 ; [#uses=0]
18 %tr1.l = ashr i64 1, 4 ; [#uses=0]
19 %shift.upgrd.7 = zext i8 %shamt to i64 ; [#uses=1]
20 %tr2.l = ashr i64 1, %shift.upgrd.7 ; [#uses=0]
21 %tr3.l = shl i64 1, 4 ; [#uses=0]
22 %shift.upgrd.8 = zext i8 %shamt to i64 ; [#uses=1]
23 %tr4.l = shl i64 1, %shift.upgrd.8 ; [#uses=0]
24 %tr1.u = lshr i64 1, 5 ; [#uses=0]
25 %shift.upgrd.9 = zext i8 %shamt to i64 ; [#uses=1]
26 %tr2.u = lshr i64 1, %shift.upgrd.9 ; [#uses=0]
27 %tr3.u = shl i64 1, 5 ; [#uses=0]
28 %shift.upgrd.10 = zext i8 %shamt to i64 ; [#uses=1]
29 %tr4.u = shl i64 1, %shift.upgrd.10 ; [#uses=0]
30 ret i32 0
31 }
170170 @$(ECHOPATH) s=@ENABLE_ASSERTIONS@=$(ENABLE_ASSERTIONS)=g >> lit.tmp
171171 @$(ECHOPATH) s=@TARGETS_TO_BUILD@=$(TARGETS_TO_BUILD)=g >> lit.tmp
172172 @$(ECHOPATH) s=@LLVM_BINDINGS@=$(BINDINGS_TO_BUILD)=g >> lit.tmp
173 @$(ECHOPATH) s=@HOST_OS@=$(HOST_OS)=g >> lit.tmp
174 @$(ECHOPATH) s=@HOST_ARCH@=$(HOST_ARCH)=g >> lit.tmp
173175 @sed -f lit.tmp $(PROJ_SRC_DIR)/lit.site.cfg.in > $@
174176 @-rm -f lit.tmp
175177
183185 @$(ECHOPATH) s=@ENABLE_SHARED@=$(ENABLE_SHARED)=g >> unit.tmp
184186 @$(ECHOPATH) s=@SHLIBDIR@=$(SharedLibDir)=g >> unit.tmp
185187 @$(ECHOPATH) s=@SHLIBPATH_VAR@=$(SHLIBPATH_VAR)=g >> unit.tmp
188 @$(ECHOPATH) s=@HOST_OS@=$(HOST_OS)=g >> unit.tmp
189 @$(ECHOPATH) s=@HOST_ARCH@=$(HOST_ARCH)=g >> lit.tmp
186190 @sed -f unit.tmp $(PROJ_SRC_DIR)/Unit/lit.site.cfg.in > $@
187191 @-rm -f unit.tmp
88 config.enable_assertions = @ENABLE_ASSERTIONS@
99 config.targets_to_build = "@TARGETS_TO_BUILD@"
1010 config.llvm_bindings = "@LLVM_BINDINGS@"
11 config.host_os = "@HOST_OS@"
12 config.host_arch = "@HOST_ARCH@"
1113
1214 # Support substitution of the tools_dir with user parameters. This is
1315 # used when we can't determine the tool dir at configuration time.