diff options
Diffstat (limited to 'tests/cases')
-rw-r--r-- | tests/cases/aliasbitcastdollar.ll | 27 | ||||
-rw-r--r-- | tests/cases/complexphi.ll | 4 | ||||
-rw-r--r-- | tests/cases/dash.ll | 18 | ||||
-rw-r--r-- | tests/cases/emptystruct.ll | 21 | ||||
-rw-r--r-- | tests/cases/frem.ll | 13 | ||||
-rw-r--r-- | tests/cases/frem.txt | 1 | ||||
-rw-r--r-- | tests/cases/funcptr.ll | 27 | ||||
-rw-r--r-- | tests/cases/funcptr.txt | 1 | ||||
-rw-r--r-- | tests/cases/phientryimplicitmoar.ll | 28 | ||||
-rw-r--r-- | tests/cases/phientryimplicitmoar.txt | 6 | ||||
-rw-r--r-- | tests/cases/phinonexist.ll | 25 | ||||
-rw-r--r-- | tests/cases/quotedlabel.ll | 19 | ||||
-rw-r--r-- | tests/cases/subnums.ll | 18 | ||||
-rw-r--r-- | tests/cases/subnums.txt | 1 | ||||
-rw-r--r-- | tests/cases/uadd_overflow.ll | 25 | ||||
-rw-r--r-- | tests/cases/uadd_overflow.txt | 1 |
16 files changed, 235 insertions, 0 deletions
diff --git a/tests/cases/aliasbitcastdollar.ll b/tests/cases/aliasbitcastdollar.ll new file mode 100644 index 00000000..1ecf6047 --- /dev/null +++ b/tests/cases/aliasbitcastdollar.ll @@ -0,0 +1,27 @@ +; ModuleID = '/tmp/emscripten/tmp/src.cpp.o' +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-n8:16:32" +target triple = "i386-pc-linux-gnu" + +@.str = private constant [14 x i8] c"hello, world!\00", align 1 ; [#uses=1] + +@"other$name" = alias bitcast (void ()* @original to void (i32)*) ; [#uses=1] + +; [#uses=2] +define void @original() { +entry: + %0 = call i32 bitcast (i32 (i8*)* @puts to i32 (i32*)*)(i8* getelementptr inbounds ([14 x i8]* @.str, i32 0, i32 0)) ; [#uses=0] + br label %return + +return: ; preds = %entry + ret void +} + +; [#uses=1] +declare i32 @puts(i8*) + +; [#uses=0] +define i32 @main() { +entry: + call void @"other$name"(i32 5) + ret i32 0 +} diff --git a/tests/cases/complexphi.ll b/tests/cases/complexphi.ll index 6f64af06..fcb7185f 100644 --- a/tests/cases/complexphi.ll +++ b/tests/cases/complexphi.ll @@ -3,6 +3,7 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3 target triple = "i386-pc-linux-gnu" @.str = private unnamed_addr constant [15 x i8] c"hello, world!\0A\00", align 1 ; [#uses=1 type=[15 x i8]*] +@_dispatchTable = internal global i64 0 ; [#uses=0] define i32 @main() { @@ -19,6 +20,9 @@ cond.null: cond.end: ; preds = %cond.false, %cond.true %cond = phi { i32, i32 } [ { i32 5, i32 6 }, %entry ], [ zeroinitializer, %cond.null ] ; [#uses=1] store { i32, i32 } %cond, { i32, i32 }* %comp + + store { i32, i32 } { i32 ptrtoint (i64* @_dispatchTable to i32), i32 0 }, { i32, i32 }* getelementptr inbounds ([1 x i64]* @_dispatchTable, i32 0, i32 0, i32 1), align 4 + ret i32 0 ; [debug line = 6:13] } diff --git a/tests/cases/dash.ll b/tests/cases/dash.ll new file mode 100644 index 00000000..ed5b01ae --- /dev/null +++ b/tests/cases/dash.ll @@ -0,0 +1,18 @@ +; ModuleID = '/tmp/tmpqfApGD/a.out.bc' +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-n8:16:32-S128" +target triple = "i386-pc-linux-gnu" + +@other-name = alias i32 ()* @main + +@.st-r = private unnamed_addr constant [15 x i8] c"hello, world!\0A\00", align 1 + +define i32 @main() { +entry: + %ret-val = alloca i32, align 4 + store i32 0, i32* %ret-val + %aaa = bitcast i32 ()* @other-name to i32 + %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([15 x i8]* @.st-r, i32 0, i32 0), i32 %aaa) + ret i32 %ret-val +} + +declare i32 @printf(i8*, ...) diff --git a/tests/cases/emptystruct.ll b/tests/cases/emptystruct.ll new file mode 100644 index 00000000..d4165fdd --- /dev/null +++ b/tests/cases/emptystruct.ll @@ -0,0 +1,21 @@ +; ModuleID = 'emptystruct.c' +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-n8:16:32-S128" +target triple = "i386-pc-linux-gnu" + +%struct.s = type { {}, i32 } + +@.str = private constant [14 x i8] c"hello, world!\00", align 1 ; [#uses=1] + +define i32 @main() nounwind { +entry: + %z = alloca %struct.s, align 4 + %0 = bitcast %struct.s* %z to i8* + call void @llvm.memset.p0i8.i32(i8* %0, i8 0, i32 4, i32 4, i1 false) + %0 = call i32 bitcast (i32 (i8*)* @puts to i32 (i32*)*)(i8* getelementptr inbounds ([14 x i8]* @.str, i32 0, i32 0)) ; [#uses=0] + ret i32 0 +} + +declare void @llvm.memset.p0i8.i32(i8* nocapture, i8, i32, i32, i1) nounwind + +declare i32 @puts(i8*) + diff --git a/tests/cases/frem.ll b/tests/cases/frem.ll new file mode 100644 index 00000000..442cd04c --- /dev/null +++ b/tests/cases/frem.ll @@ -0,0 +1,13 @@ +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-n8:16:32" +target triple = "i386-pc-linux-gnu" + +@.str2 = private constant [6 x i8] c"*%f*\0A\00", align 1 ; [#uses=1] + +declare i32 @printf(i8* noalias, ...) nounwind + +define i32 @main() { +entry: + %c = frem double 2.5, 1.0 + %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([6 x i8]* @.str2, i32 0, i32 0), double %c) + ret i32 0 +} diff --git a/tests/cases/frem.txt b/tests/cases/frem.txt new file mode 100644 index 00000000..3a7ecb6a --- /dev/null +++ b/tests/cases/frem.txt @@ -0,0 +1 @@ +*0.500000* diff --git a/tests/cases/funcptr.ll b/tests/cases/funcptr.ll new file mode 100644 index 00000000..07e2bf91 --- /dev/null +++ b/tests/cases/funcptr.ll @@ -0,0 +1,27 @@ +; ModuleID = 'tests/hello_world.bc' +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-n8:16:32-S128" +target triple = "i386-pc-linux-gnu" + +@.str = private unnamed_addr constant [17 x i8] c"hello %d world!\0A\00", align 1 ; [#uses=1 type=[17 x i8]*] + +; [#uses=0] +define i32 @main() { +entry: + %retval = alloca i32, align 4 ; [#uses=1 type=i32*] + store i32 0, i32* %retval + %access_virt_barray = bitcast i32 0 to [64 x i16]* (i32*, i32)** + store [64 x i16]* (i32*, i32)* @access_virt_barray, [64 x i16]* (i32*, i32)** %access_virt_barray, align 4 + %wakaptr = bitcast [64 x i16]* (i32*, i32)** %access_virt_barray to i32* + %waka = load i32* %wakaptr + %waka2 = icmp eq i32 %waka, 0 + %waka3 = zext i1 %waka2 to i32 + %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([17 x i8]* @.str, i32 0, i32 0), i32 %waka3) ; [#uses=0 type=i32] + ret i32 1 +} + +define [64 x i16]* @access_virt_barray(i32*, i32) { + ret void +} + +; [#uses=1] +declare i32 @printf(i8*, ...) diff --git a/tests/cases/funcptr.txt b/tests/cases/funcptr.txt new file mode 100644 index 00000000..1030830d --- /dev/null +++ b/tests/cases/funcptr.txt @@ -0,0 +1 @@ +hello 0 world! diff --git a/tests/cases/phientryimplicitmoar.ll b/tests/cases/phientryimplicitmoar.ll new file mode 100644 index 00000000..c83458e6 --- /dev/null +++ b/tests/cases/phientryimplicitmoar.ll @@ -0,0 +1,28 @@ +; ModuleID = 'tests/hello_world.bc' +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-n8:16:32-S128" +target triple = "i386-pc-linux-gnu" + +@.str = private unnamed_addr constant [15 x i8] c"hello, world!\0A\00", align 1 ; [#uses=1 type=[15 x i8]*] +@.str2 = private unnamed_addr constant [15 x i8] c"hello!!world!\0A\00", align 1 ; [#uses=1 type=[15 x i8]*] + +define i32 @main() { + %retval = alloca i32, align 4 + %call2 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([15 x i8]* @.str2, i32 0, i32 0)) + %a12 = zext i1 1 to i32 + br label %13 + +; <label>:13 ; preds = %13, %1 + %a14 = phi i32 [ %a12, %1 ], [ %a15, %13 ] + %call0 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([15 x i8]* @.str, i32 0, i32 0)) + %a15 = add nsw i32 %a14, 2 + %a16 = icmp eq i32 %a15, 9 + br i1 %a16, label %17, label %13 + +; <label>:17 ; preds = %1 + %call1 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([15 x i8]* @.str2, i32 0, i32 0)) + ret i32 1 +} + +; [#uses=1] +declare i32 @printf(i8*, ...) + diff --git a/tests/cases/phientryimplicitmoar.txt b/tests/cases/phientryimplicitmoar.txt new file mode 100644 index 00000000..50e5e9ae --- /dev/null +++ b/tests/cases/phientryimplicitmoar.txt @@ -0,0 +1,6 @@ +hello!!world! +hello, world! +hello, world! +hello, world! +hello, world! +hello!!world! diff --git a/tests/cases/phinonexist.ll b/tests/cases/phinonexist.ll new file mode 100644 index 00000000..145d2221 --- /dev/null +++ b/tests/cases/phinonexist.ll @@ -0,0 +1,25 @@ +; ModuleID = 'tests/hello_world.bc' +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-n8:16:32-S128" +target triple = "i386-pc-linux-gnu" + +@.str = private unnamed_addr constant [15 x i8] c"hello, world!\0A\00", align 1 ; [#uses=1 type=[15 x i8]*] + +define i32 @main() { + %retval = alloca i32, align 4 + %a12 = zext i1 1 to i32 + br label %13 + +; <label>:13 ; preds = %13, %1 + %a14 = phi i32 [ %a12, %1 ], [ %a15, %135 ] + %call0 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([15 x i8]* @.str, i32 0, i32 0)) + %a15 = add nsw i32 %a14, 2 + %a16 = icmp eq i32 %a15, 9 + br label %17 + +; <label>:17 ; preds = %1 + ret i32 1 +} + +; [#uses=1] +declare i32 @printf(i8*, ...) + diff --git a/tests/cases/quotedlabel.ll b/tests/cases/quotedlabel.ll new file mode 100644 index 00000000..d32e380a --- /dev/null +++ b/tests/cases/quotedlabel.ll @@ -0,0 +1,19 @@ +; ModuleID = '/tmp/emscripten/tmp/src.cpp.o' +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-n8:16:32" +target triple = "i386-pc-linux-gnu" + +@.str = private constant [14 x i8] c"hello, world!\00", align 1 ; [#uses=1] + +; [#uses=1] +declare i32 @puts(i8*) + +; [#uses=0] +define i32 @main() { +entry: + br label %"finish$$$" + +"finish$$$": ; preds = %entry + %0 = call i32 bitcast (i32 (i8*)* @puts to i32 (i32*)*)(i8* getelementptr inbounds ([14 x i8]* @.str, i32 0, i32 0)) ; [#uses=0] + ret i32 0 +} + diff --git a/tests/cases/subnums.ll b/tests/cases/subnums.ll new file mode 100644 index 00000000..981a1592 --- /dev/null +++ b/tests/cases/subnums.ll @@ -0,0 +1,18 @@ +; ModuleID = 'tests/hello_world.bc' +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-n8:16:32-S128" +target triple = "i386-pc-linux-gnu" + +@.str = private unnamed_addr constant [15 x i8] c"hello, world! %d\0A\00", align 1 ; [#uses=1 type=[18 x i8]*] + +; [#uses=0] +define i32 @main() { +entry: + %retval = alloca i32, align 4 ; [#uses=1 type=i32*] + %sub = sub nsw i32 0, -2147483648 + store i32 %sub, i32* %retval + %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([18 x i8]* @.str, i32 0, i32 0), i32 %sub) ; [#uses=0 type=i32] + ret i32 1 +} + +; [#uses=1] +declare i32 @printf(i8*, ...) diff --git a/tests/cases/subnums.txt b/tests/cases/subnums.txt new file mode 100644 index 00000000..e8831e0b --- /dev/null +++ b/tests/cases/subnums.txt @@ -0,0 +1 @@ +hello, world! -2147483648 diff --git a/tests/cases/uadd_overflow.ll b/tests/cases/uadd_overflow.ll new file mode 100644 index 00000000..a808b9de --- /dev/null +++ b/tests/cases/uadd_overflow.ll @@ -0,0 +1,25 @@ +; ModuleID = 'tests/hello_world.bc' +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-n8:16:32-S128" +target triple = "i386-pc-linux-gnu" + +@.str2 = private constant [9 x i8] c"*%d,%d*\0A\00", align 1 ; [#uses=1] + +; [#uses=0] +define i32 @main() { +entry: + %retval = alloca i32, align 4 ; [#uses=1 type=i32*] + %mul7 = bitcast i32 -259741926 to i32 + %shl10 = shl i32 4014, 16 + %uadd1 = tail call { i32, i1 } @llvm.uadd.with.overflow.i32(i32 %mul7, i32 %shl10) + %a0 = extractvalue { i32, i1 } %uadd1, 0 + %a1 = extractvalue { i32, i1 } %uadd1, 1 + %a2 = zext i1 %a1 to i32 + call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([9 x i8]* @.str2, i32 0, i32 0), i32 %a0, i32 %a2) ; [#uses=0] + ret i32 1 +} + +; [#uses=1] +declare i32 @printf(i8*, ...) + +declare { i32, i1 } @llvm.uadd.with.overflow.i32(i32, i32) nounwind readnone + diff --git a/tests/cases/uadd_overflow.txt b/tests/cases/uadd_overflow.txt new file mode 100644 index 00000000..dcda9240 --- /dev/null +++ b/tests/cases/uadd_overflow.txt @@ -0,0 +1 @@ +*3319578,1* |