summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorrdivacky <rdivacky@FreeBSD.org>2009-11-05 17:17:44 +0000
committerrdivacky <rdivacky@FreeBSD.org>2009-11-05 17:17:44 +0000
commitded64d5d348ce8d8c5aa42cf63f6de9dd84b7e89 (patch)
treeadc0bc5dc9cb37579ee90d3c0f08c98c0711bebe /test
parentee2025263d979561bba11dc526f01d690a2565e7 (diff)
downloadFreeBSD-src-ded64d5d348ce8d8c5aa42cf63f6de9dd84b7e89.zip
FreeBSD-src-ded64d5d348ce8d8c5aa42cf63f6de9dd84b7e89.tar.gz
Update LLVM to r86140.
Diffstat (limited to 'test')
-rw-r--r--test/Analysis/PointerTracking/sizes.ll18
-rw-r--r--test/CodeGen/ARM/indirectbr.ll60
-rw-r--r--test/CodeGen/PowerPC/indirectbr.ll55
-rw-r--r--test/Transforms/DeadStoreElimination/no-targetdata.ll15
-rw-r--r--test/Transforms/GlobalOpt/2009-06-01-RecursivePHI.ll7
-rw-r--r--test/Transforms/GlobalOpt/heap-sra-1.ll16
-rw-r--r--test/Transforms/GlobalOpt/heap-sra-2.ll14
-rw-r--r--test/Transforms/GlobalOpt/heap-sra-3.ll14
-rw-r--r--test/Transforms/GlobalOpt/heap-sra-4.ll14
-rw-r--r--test/Transforms/GlobalOpt/heap-sra-phi.ll8
-rw-r--r--test/Transforms/GlobalOpt/malloc-promote-1.ll9
-rw-r--r--test/Transforms/GlobalOpt/malloc-promote-2.ll8
-rw-r--r--test/Transforms/GlobalOpt/malloc-promote-3.ll8
-rw-r--r--test/Transforms/JumpThreading/crash.ll83
14 files changed, 284 insertions, 45 deletions
diff --git a/test/Analysis/PointerTracking/sizes.ll b/test/Analysis/PointerTracking/sizes.ll
index c0b0606..267c3b8 100644
--- a/test/Analysis/PointerTracking/sizes.ll
+++ b/test/Analysis/PointerTracking/sizes.ll
@@ -31,6 +31,7 @@ entry:
}
declare i32 @bar(i8*)
+declare i32 @bar2(i64*)
define i32 @foo1(i32 %n) nounwind {
entry:
@@ -60,11 +61,16 @@ entry:
ret i32 %add16
}
-define i32 @foo2(i32 %n) nounwind {
+define i32 @foo2(i64 %n) nounwind {
entry:
- %call = malloc i8, i32 %n ; <i8*> [#uses=1]
+ %call = tail call i8* @malloc(i64 %n) ; <i8*> [#uses=1]
; CHECK: %call =
; CHECK: ==> %n elements, %n bytes allocated
+ %mallocsize = mul i64 %n, 8 ; <i64> [#uses=1]
+ %malloccall = tail call i8* @malloc(i64 %mallocsize) ; <i8*> [#uses=1]
+ %call3 = bitcast i8* %malloccall to i64* ; <i64*> [#uses=1]
+; CHECK: %malloccall =
+; CHECK: ==> (8 * %n) elements, (8 * %n) bytes allocated
%call2 = tail call i8* @calloc(i64 2, i64 4) nounwind ; <i8*> [#uses=1]
; CHECK: %call2 =
; CHECK: ==> 8 elements, 8 bytes allocated
@@ -72,13 +78,17 @@ entry:
; CHECK: %call4 =
; CHECK: ==> 16 elements, 16 bytes allocated
%call6 = tail call i32 @bar(i8* %call) nounwind ; <i32> [#uses=1]
+ %call7 = tail call i32 @bar2(i64* %call3) nounwind ; <i32> [#uses=1]
%call8 = tail call i32 @bar(i8* %call2) nounwind ; <i32> [#uses=1]
%call10 = tail call i32 @bar(i8* %call4) nounwind ; <i32> [#uses=1]
- %add = add i32 %call8, %call6 ; <i32> [#uses=1]
- %add11 = add i32 %add, %call10 ; <i32> [#uses=1]
+ %add = add i32 %call8, %call6 ; <i32> [#uses=1]
+ %add10 = add i32 %add, %call7 ; <i32> [#uses=1]
+ %add11 = add i32 %add10, %call10 ; <i32> [#uses=1]
ret i32 %add11
}
+declare noalias i8* @malloc(i64) nounwind
+
declare noalias i8* @calloc(i64, i64) nounwind
declare noalias i8* @realloc(i8* nocapture, i64) nounwind
diff --git a/test/CodeGen/ARM/indirectbr.ll b/test/CodeGen/ARM/indirectbr.ll
new file mode 100644
index 0000000..cf4a1ab
--- /dev/null
+++ b/test/CodeGen/ARM/indirectbr.ll
@@ -0,0 +1,60 @@
+; RUN: llc < %s -relocation-model=pic -mtriple=arm-apple-darwin | FileCheck %s -check-prefix=ARM
+; RUN: llc < %s -relocation-model=pic -mtriple=thumb-apple-darwin | FileCheck %s -check-prefix=THUMB
+; RUN: llc < %s -relocation-model=static -mtriple=thumbv7-apple-darwin | FileCheck %s -check-prefix=THUMB2
+
+@nextaddr = global i8* null ; <i8**> [#uses=2]
+@C.0.2070 = private constant [5 x i8*] [i8* blockaddress(@foo, %L1), i8* blockaddress(@foo, %L2), i8* blockaddress(@foo, %L3), i8* blockaddress(@foo, %L4), i8* blockaddress(@foo, %L5)] ; <[5 x i8*]*> [#uses=1]
+
+define internal arm_apcscc i32 @foo(i32 %i) nounwind {
+; ARM: foo:
+; THUMB: foo:
+; THUMB2: foo:
+entry:
+ %0 = load i8** @nextaddr, align 4 ; <i8*> [#uses=2]
+ %1 = icmp eq i8* %0, null ; <i1> [#uses=1]
+ br i1 %1, label %bb3, label %bb2
+
+bb2: ; preds = %entry, %bb3
+ %gotovar.4.0 = phi i8* [ %gotovar.4.0.pre, %bb3 ], [ %0, %entry ] ; <i8*> [#uses=1]
+; ARM: bx
+; THUMB: mov pc, r1
+; THUMB2: mov pc, r1
+ indirectbr i8* %gotovar.4.0, [label %L5, label %L4, label %L3, label %L2, label %L1]
+
+bb3: ; preds = %entry
+ %2 = getelementptr inbounds [5 x i8*]* @C.0.2070, i32 0, i32 %i ; <i8**> [#uses=1]
+ %gotovar.4.0.pre = load i8** %2, align 4 ; <i8*> [#uses=1]
+ br label %bb2
+
+L5: ; preds = %bb2
+ br label %L4
+
+L4: ; preds = %L5, %bb2
+ %res.0 = phi i32 [ 385, %L5 ], [ 35, %bb2 ] ; <i32> [#uses=1]
+ br label %L3
+
+L3: ; preds = %L4, %bb2
+ %res.1 = phi i32 [ %res.0, %L4 ], [ 5, %bb2 ] ; <i32> [#uses=1]
+ br label %L2
+
+L2: ; preds = %L3, %bb2
+ %res.2 = phi i32 [ %res.1, %L3 ], [ 1, %bb2 ] ; <i32> [#uses=1]
+ %phitmp = mul i32 %res.2, 6 ; <i32> [#uses=1]
+ br label %L1
+
+L1: ; preds = %L2, %bb2
+ %res.3 = phi i32 [ %phitmp, %L2 ], [ 2, %bb2 ] ; <i32> [#uses=1]
+; ARM: ldr r1, LCPI
+; ARM: add r1, pc, r1
+; ARM: str r1
+; THUMB: ldr.n r2, LCPI
+; THUMB: add r2, pc
+; THUMB: str r2
+; THUMB2: ldr.n r2, LCPI
+; THUMB2-NEXT: str r2
+ store i8* blockaddress(@foo, %L5), i8** @nextaddr, align 4
+ ret i32 %res.3
+}
+; ARM: .long L_foo_L5-(LPC{{.*}}+8)
+; THUMB: .long L_foo_L5-(LPC{{.*}}+4)
+; THUMB2: .long L_foo_L5
diff --git a/test/CodeGen/PowerPC/indirectbr.ll b/test/CodeGen/PowerPC/indirectbr.ll
new file mode 100644
index 0000000..ee0a02b
--- /dev/null
+++ b/test/CodeGen/PowerPC/indirectbr.ll
@@ -0,0 +1,55 @@
+; RUN: llc < %s -relocation-model=pic -march=ppc32 -mtriple=powerpc-apple-darwin | FileCheck %s -check-prefix=PIC
+; RUN: llc < %s -relocation-model=static -march=ppc32 -mtriple=powerpc-apple-darwin | FileCheck %s -check-prefix=STATIC
+
+@nextaddr = global i8* null ; <i8**> [#uses=2]
+@C.0.2070 = private constant [5 x i8*] [i8* blockaddress(@foo, %L1), i8* blockaddress(@foo, %L2), i8* blockaddress(@foo, %L3), i8* blockaddress(@foo, %L4), i8* blockaddress(@foo, %L5)] ; <[5 x i8*]*> [#uses=1]
+
+define internal i32 @foo(i32 %i) nounwind {
+; PIC: foo:
+; STATIC: foo:
+entry:
+ %0 = load i8** @nextaddr, align 4 ; <i8*> [#uses=2]
+ %1 = icmp eq i8* %0, null ; <i1> [#uses=1]
+ br i1 %1, label %bb3, label %bb2
+
+bb2: ; preds = %entry, %bb3
+ %gotovar.4.0 = phi i8* [ %gotovar.4.0.pre, %bb3 ], [ %0, %entry ] ; <i8*> [#uses=1]
+; PIC: mtctr
+; PIC-NEXT: bctr
+; STATIC: mtctr
+; STATIC-NEXT: bctr
+ indirectbr i8* %gotovar.4.0, [label %L5, label %L4, label %L3, label %L2, label %L1]
+
+bb3: ; preds = %entry
+ %2 = getelementptr inbounds [5 x i8*]* @C.0.2070, i32 0, i32 %i ; <i8**> [#uses=1]
+ %gotovar.4.0.pre = load i8** %2, align 4 ; <i8*> [#uses=1]
+ br label %bb2
+
+L5: ; preds = %bb2
+ br label %L4
+
+L4: ; preds = %L5, %bb2
+ %res.0 = phi i32 [ 385, %L5 ], [ 35, %bb2 ] ; <i32> [#uses=1]
+ br label %L3
+
+L3: ; preds = %L4, %bb2
+ %res.1 = phi i32 [ %res.0, %L4 ], [ 5, %bb2 ] ; <i32> [#uses=1]
+ br label %L2
+
+L2: ; preds = %L3, %bb2
+ %res.2 = phi i32 [ %res.1, %L3 ], [ 1, %bb2 ] ; <i32> [#uses=1]
+ %phitmp = mul i32 %res.2, 6 ; <i32> [#uses=1]
+ br label %L1
+
+L1: ; preds = %L2, %bb2
+ %res.3 = phi i32 [ %phitmp, %L2 ], [ 2, %bb2 ] ; <i32> [#uses=1]
+; PIC: addis r4, r2, ha16(L_foo_L5-"L1$pb")
+; PIC: li r5, lo16(L_foo_L5-"L1$pb")
+; PIC: add r4, r4, r5
+; PIC: stw r4
+; STATIC: li r2, lo16(L_foo_L5)
+; STATIC: addis r2, r2, ha16(L_foo_L5)
+; STATIC: stw r2
+ store i8* blockaddress(@foo, %L5), i8** @nextaddr, align 4
+ ret i32 %res.3
+}
diff --git a/test/Transforms/DeadStoreElimination/no-targetdata.ll b/test/Transforms/DeadStoreElimination/no-targetdata.ll
new file mode 100644
index 0000000..42c4e1b
--- /dev/null
+++ b/test/Transforms/DeadStoreElimination/no-targetdata.ll
@@ -0,0 +1,15 @@
+; RUN: opt %s -dse -S | FileCheck %s
+
+declare void @test1f()
+
+define void @test1(i32* noalias %p) {
+ store i32 1, i32* %p;
+ call void @test1f()
+ store i32 2, i32 *%p
+ ret void
+; CHECK: define void @test1
+; CHECK-NOT: store
+; CHECK-NEXT: call void
+; CHECK-NEXT: store i32 2
+; CHECK-NEXT: ret void
+} \ No newline at end of file
diff --git a/test/Transforms/GlobalOpt/2009-06-01-RecursivePHI.ll b/test/Transforms/GlobalOpt/2009-06-01-RecursivePHI.ll
index abd3109..d3c3ff5 100644
--- a/test/Transforms/GlobalOpt/2009-06-01-RecursivePHI.ll
+++ b/test/Transforms/GlobalOpt/2009-06-01-RecursivePHI.ll
@@ -1,4 +1,5 @@
; RUN: opt < %s -globalopt
+target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128"
%struct.s_annealing_sched = type { i32, float, float, float, float }
%struct.s_bb = type { i32, i32, i32, i32 }
@@ -96,7 +97,9 @@ bb.i34: ; preds = %bb
unreachable
bb1.i38: ; preds = %bb
- %0 = malloc %struct.s_net, i32 undef ; <%struct.s_net*> [#uses=1]
+ %mallocsize = mul i64 28, undef ; <i64> [#uses=1]
+ %malloccall = tail call i8* @malloc(i64 %mallocsize) ; <i8*> [#uses=1]
+ %0 = bitcast i8* %malloccall to %struct.s_net* ; <%struct.s_net*> [#uses=1]
br i1 undef, label %bb.i1.i39, label %my_malloc.exit2.i
bb.i1.i39: ; preds = %bb1.i38
@@ -115,3 +118,5 @@ my_malloc.exit8.i: ; preds = %my_malloc.exit2.i
bb7: ; preds = %bb6.preheader
unreachable
}
+
+declare noalias i8* @malloc(i64)
diff --git a/test/Transforms/GlobalOpt/heap-sra-1.ll b/test/Transforms/GlobalOpt/heap-sra-1.ll
index 6df559e..9d5148f 100644
--- a/test/Transforms/GlobalOpt/heap-sra-1.ll
+++ b/test/Transforms/GlobalOpt/heap-sra-1.ll
@@ -1,18 +1,22 @@
-; RUN: opt < %s -globalopt -S | grep {@X.f0}
-; RUN: opt < %s -globalopt -S | grep {@X.f1}
-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:128:128"
-target triple = "i386-apple-darwin7"
+; RUN: opt < %s -globalopt -S | FileCheck %s
+target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128"
%struct.foo = type { i32, i32 }
@X = internal global %struct.foo* null
+; CHECK: @X.f0
+; CHECK: @X.f1
-define void @bar(i32 %Size) nounwind noinline {
+define void @bar(i64 %Size) nounwind noinline {
entry:
- %.sub = malloc %struct.foo, i32 %Size
+ %mallocsize = mul i64 %Size, 8 ; <i64> [#uses=1]
+ %malloccall = tail call i8* @malloc(i64 %mallocsize) ; <i8*> [#uses=1]
+ %.sub = bitcast i8* %malloccall to %struct.foo* ; <%struct.foo*> [#uses=1]
store %struct.foo* %.sub, %struct.foo** @X, align 4
ret void
}
+declare noalias i8* @malloc(i64)
+
define i32 @baz() nounwind readonly noinline {
bb1.thread:
%0 = load %struct.foo** @X, align 4
diff --git a/test/Transforms/GlobalOpt/heap-sra-2.ll b/test/Transforms/GlobalOpt/heap-sra-2.ll
index 5a3c3cd1..fa8c362 100644
--- a/test/Transforms/GlobalOpt/heap-sra-2.ll
+++ b/test/Transforms/GlobalOpt/heap-sra-2.ll
@@ -1,20 +1,22 @@
-; RUN: opt < %s -globalopt -S | grep {@X.f0}
-; RUN: opt < %s -globalopt -S | grep {@X.f1}
+; RUN: opt < %s -globalopt -S | FileCheck %s
+target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128"
-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:128:128"
-target triple = "i386-apple-darwin7"
%struct.foo = type { i32, i32 }
@X = internal global %struct.foo* null ; <%struct.foo**> [#uses=2]
+; CHECK: @X.f0
+; CHECK: @X.f1
define void @bar(i32 %Size) nounwind noinline {
entry:
- %0 = malloc [1000000 x %struct.foo]
- ;%.sub = bitcast [1000000 x %struct.foo]* %0 to %struct.foo*
+ %malloccall = tail call i8* @malloc(i64 8000000) ; <i8*> [#uses=1]
+ %0 = bitcast i8* %malloccall to [1000000 x %struct.foo]* ; <[1000000 x %struct.foo]*> [#uses=1]
%.sub = getelementptr [1000000 x %struct.foo]* %0, i32 0, i32 0 ; <%struct.foo*> [#uses=1]
store %struct.foo* %.sub, %struct.foo** @X, align 4
ret void
}
+declare noalias i8* @malloc(i64)
+
define i32 @baz() nounwind readonly noinline {
bb1.thread:
%0 = load %struct.foo** @X, align 4 ; <%struct.foo*> [#uses=1]
diff --git a/test/Transforms/GlobalOpt/heap-sra-3.ll b/test/Transforms/GlobalOpt/heap-sra-3.ll
index 1496485..cbbcdfc 100644
--- a/test/Transforms/GlobalOpt/heap-sra-3.ll
+++ b/test/Transforms/GlobalOpt/heap-sra-3.ll
@@ -1,24 +1,22 @@
; RUN: opt < %s -globalopt -S | FileCheck %s
-
-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:128:128"
-target triple = "i386-apple-darwin10"
+target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128"
%struct.foo = type { i32, i32 }
@X = internal global %struct.foo* null
; CHECK: @X.f0
; CHECK: @X.f1
-define void @bar(i32 %Size) nounwind noinline {
+define void @bar(i64 %Size) nounwind noinline {
entry:
- %mallocsize = mul i32 ptrtoint (%struct.foo* getelementptr (%struct.foo* null, i32 1) to i32), %Size, ; <i32> [#uses=1]
-; CHECK: mul i32 %Size
- %malloccall = tail call i8* @malloc(i32 %mallocsize) ; <i8*> [#uses=1]
+ %mallocsize = mul i64 8, %Size, ; <i64> [#uses=1]
+; CHECK: mul i64 %Size, 4
+ %malloccall = tail call i8* @malloc(i64 %mallocsize) ; <i8*> [#uses=1]
%.sub = bitcast i8* %malloccall to %struct.foo* ; <%struct.foo*> [#uses=1]
store %struct.foo* %.sub, %struct.foo** @X, align 4
ret void
}
-declare noalias i8* @malloc(i32)
+declare noalias i8* @malloc(i64)
define i32 @baz() nounwind readonly noinline {
bb1.thread:
diff --git a/test/Transforms/GlobalOpt/heap-sra-4.ll b/test/Transforms/GlobalOpt/heap-sra-4.ll
index ae97ef1..d5a5828 100644
--- a/test/Transforms/GlobalOpt/heap-sra-4.ll
+++ b/test/Transforms/GlobalOpt/heap-sra-4.ll
@@ -1,24 +1,22 @@
; RUN: opt < %s -globalopt -S | FileCheck %s
-
-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:128:128"
-target triple = "i386-apple-darwin7"
+target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128"
%struct.foo = type { i32, i32 }
@X = internal global %struct.foo* null
; CHECK: @X.f0
; CHECK: @X.f1
-define void @bar(i32 %Size) nounwind noinline {
+define void @bar(i64 %Size) nounwind noinline {
entry:
- %mallocsize = shl i32 ptrtoint (%struct.foo* getelementptr (%struct.foo* null, i32 1) to i32), 9, ; <i32> [#uses=1]
- %malloccall = tail call i8* @malloc(i32 %mallocsize) ; <i8*> [#uses=1]
-; CHECK: @malloc(i32 mul (i32 512
+ %mallocsize = shl i64 %Size, 3 ; <i64> [#uses=1]
+ %malloccall = tail call i8* @malloc(i64 %mallocsize) ; <i8*> [#uses=1]
+; CHECK: mul i64 %Size, 4
%.sub = bitcast i8* %malloccall to %struct.foo* ; <%struct.foo*> [#uses=1]
store %struct.foo* %.sub, %struct.foo** @X, align 4
ret void
}
-declare noalias i8* @malloc(i32)
+declare noalias i8* @malloc(i64)
define i32 @baz() nounwind readonly noinline {
bb1.thread:
diff --git a/test/Transforms/GlobalOpt/heap-sra-phi.ll b/test/Transforms/GlobalOpt/heap-sra-phi.ll
index 2eba944..6188e5a 100644
--- a/test/Transforms/GlobalOpt/heap-sra-phi.ll
+++ b/test/Transforms/GlobalOpt/heap-sra-phi.ll
@@ -1,19 +1,21 @@
; RUN: opt < %s -globalopt -S | grep {tmp.f1 = phi i32. }
; RUN: opt < %s -globalopt -S | grep {tmp.f0 = phi i32. }
+target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128"
-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:128:128"
-target triple = "i386-apple-darwin7"
%struct.foo = type { i32, i32 }
@X = internal global %struct.foo* null ; <%struct.foo**> [#uses=2]
define void @bar(i32 %Size) nounwind noinline {
entry:
- %tmp = malloc [1000000 x %struct.foo] ; <[1000000 x %struct.foo]*> [#uses=1]
+ %malloccall = tail call i8* @malloc(i64 8000000) ; <i8*> [#uses=1]
+ %tmp = bitcast i8* %malloccall to [1000000 x %struct.foo]* ; <[1000000 x %struct.foo]*> [#uses=1]
%.sub = getelementptr [1000000 x %struct.foo]* %tmp, i32 0, i32 0 ; <%struct.foo*> [#uses=1]
store %struct.foo* %.sub, %struct.foo** @X, align 4
ret void
}
+declare noalias i8* @malloc(i64)
+
define i32 @baz() nounwind readonly noinline {
bb1.thread:
%tmpLD1 = load %struct.foo** @X, align 4 ; <%struct.foo*> [#uses=1]
diff --git a/test/Transforms/GlobalOpt/malloc-promote-1.ll b/test/Transforms/GlobalOpt/malloc-promote-1.ll
index fd510e3..51ccbbd 100644
--- a/test/Transforms/GlobalOpt/malloc-promote-1.ll
+++ b/test/Transforms/GlobalOpt/malloc-promote-1.ll
@@ -1,19 +1,24 @@
-; RUN: opt < %s -globalopt -S | not grep global
+; RUN: opt < %s -globalopt -S | FileCheck %s
target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128"
@G = internal global i32* null ; <i32**> [#uses=3]
+; CHECK-NOT: global
define void @init() {
- %P = malloc i32 ; <i32*> [#uses=1]
+ %malloccall = tail call i8* @malloc(i64 4) ; <i8*> [#uses=1]
+ %P = bitcast i8* %malloccall to i32* ; <i32*> [#uses=1]
store i32* %P, i32** @G
%GV = load i32** @G ; <i32*> [#uses=1]
store i32 0, i32* %GV
ret void
}
+declare noalias i8* @malloc(i64)
+
define i32 @get() {
%GV = load i32** @G ; <i32*> [#uses=1]
%V = load i32* %GV ; <i32> [#uses=1]
ret i32 %V
+; CHECK: ret i32 0
}
diff --git a/test/Transforms/GlobalOpt/malloc-promote-2.ll b/test/Transforms/GlobalOpt/malloc-promote-2.ll
index d3d2252..f989b79 100644
--- a/test/Transforms/GlobalOpt/malloc-promote-2.ll
+++ b/test/Transforms/GlobalOpt/malloc-promote-2.ll
@@ -1,11 +1,11 @@
; RUN: opt < %s -globalopt -globaldce -S | not grep malloc
-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:128:128"
-target triple = "i686-apple-darwin8"
+target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128"
@G = internal global i32* null ; <i32**> [#uses=3]
define void @init() {
- %P = malloc i32, i32 100 ; <i32*> [#uses=1]
+ %malloccall = tail call i8* @malloc(i64 mul (i64 100, i64 4)) ; <i8*> [#uses=1]
+ %P = bitcast i8* %malloccall to i32* ; <i32*> [#uses=1]
store i32* %P, i32** @G
%GV = load i32** @G ; <i32*> [#uses=1]
%GVe = getelementptr i32* %GV, i32 40 ; <i32*> [#uses=1]
@@ -13,6 +13,8 @@ define void @init() {
ret void
}
+declare noalias i8* @malloc(i64)
+
define i32 @get() {
%GV = load i32** @G ; <i32*> [#uses=1]
%GVe = getelementptr i32* %GV, i32 40 ; <i32*> [#uses=1]
diff --git a/test/Transforms/GlobalOpt/malloc-promote-3.ll b/test/Transforms/GlobalOpt/malloc-promote-3.ll
index a920b61..57f937d 100644
--- a/test/Transforms/GlobalOpt/malloc-promote-3.ll
+++ b/test/Transforms/GlobalOpt/malloc-promote-3.ll
@@ -1,11 +1,11 @@
; RUN: opt < %s -globalopt -globaldce -S | not grep malloc
-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:128:128"
-target triple = "i686-apple-darwin8"
+target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128"
@G = internal global i32* null ; <i32**> [#uses=4]
define void @init() {
- %P = malloc i32, i32 100 ; <i32*> [#uses=1]
+ %malloccall = tail call i8* @malloc(i64 mul (i64 100, i64 4)) ; <i8*> [#uses=1]
+ %P = bitcast i8* %malloccall to i32* ; <i32*> [#uses=1]
store i32* %P, i32** @G
%GV = load i32** @G ; <i32*> [#uses=1]
%GVe = getelementptr i32* %GV, i32 40 ; <i32*> [#uses=1]
@@ -13,6 +13,8 @@ define void @init() {
ret void
}
+declare noalias i8* @malloc(i64)
+
define i32 @get() {
%GV = load i32** @G ; <i32*> [#uses=1]
%GVe = getelementptr i32* %GV, i32 40 ; <i32*> [#uses=1]
diff --git a/test/Transforms/JumpThreading/crash.ll b/test/Transforms/JumpThreading/crash.ll
index 023c7d0..862b403 100644
--- a/test/Transforms/JumpThreading/crash.ll
+++ b/test/Transforms/JumpThreading/crash.ll
@@ -88,4 +88,85 @@ D:
ret i32 %c
E:
ret i32 412
-} \ No newline at end of file
+}
+
+
+define i32 @test2() nounwind {
+entry:
+ br i1 true, label %decDivideOp.exit, label %bb7.i
+
+bb7.i: ; preds = %bb7.i, %entry
+ br label %bb7.i
+
+decDivideOp.exit: ; preds = %entry
+ ret i32 undef
+}
+
+
+; PR3298
+
+define i32 @test3(i32 %p_79, i32 %p_80) nounwind {
+entry:
+ br label %bb7
+
+bb1: ; preds = %bb2
+ br label %bb2
+
+bb2: ; preds = %bb7, %bb1
+ %l_82.0 = phi i8 [ 0, %bb1 ], [ %l_82.1, %bb7 ] ; <i8> [#uses=3]
+ br i1 true, label %bb3, label %bb1
+
+bb3: ; preds = %bb2
+ %0 = icmp eq i32 %p_80_addr.1, 0 ; <i1> [#uses=1]
+ br i1 %0, label %bb7, label %bb6
+
+bb5: ; preds = %bb6
+ %1 = icmp eq i8 %l_82.0, 0 ; <i1> [#uses=1]
+ br i1 %1, label %bb1.i, label %bb.i
+
+bb.i: ; preds = %bb5
+ br label %safe_div_func_char_s_s.exit
+
+bb1.i: ; preds = %bb5
+ br label %safe_div_func_char_s_s.exit
+
+safe_div_func_char_s_s.exit: ; preds = %bb1.i, %bb.i
+ br label %bb6
+
+bb6: ; preds = %safe_div_func_char_s_s.exit, %bb3
+ %p_80_addr.0 = phi i32 [ %p_80_addr.1, %bb3 ], [ 1, %safe_div_func_char_s_s.exit ] ; <i32> [#uses=2]
+ %2 = icmp eq i32 %p_80_addr.0, 0 ; <i1> [#uses=1]
+ br i1 %2, label %bb7, label %bb5
+
+bb7: ; preds = %bb6, %bb3, %entry
+ %l_82.1 = phi i8 [ 1, %entry ], [ %l_82.0, %bb3 ], [ %l_82.0, %bb6 ] ; <i8> [#uses=2]
+ %p_80_addr.1 = phi i32 [ 0, %entry ], [ %p_80_addr.1, %bb3 ], [ %p_80_addr.0, %bb6 ] ; <i32> [#uses=4]
+ %3 = icmp eq i32 %p_80_addr.1, 0 ; <i1> [#uses=1]
+ br i1 %3, label %bb8, label %bb2
+
+bb8: ; preds = %bb7
+ %4 = sext i8 %l_82.1 to i32 ; <i32> [#uses=0]
+ ret i32 0
+}
+
+
+; PR3353
+
+define i32 @test4(i8 %X) {
+entry:
+ %Y = add i8 %X, 1
+ %Z = add i8 %Y, 1
+ br label %bb33.i
+
+bb33.i: ; preds = %bb33.i, %bb32.i
+ switch i8 %Y, label %bb32.i [
+ i8 39, label %bb35.split.i
+ i8 13, label %bb33.i
+ ]
+
+bb35.split.i:
+ ret i32 5
+bb32.i:
+ ret i32 1
+}
+
OpenPOWER on IntegriCloud