diff options
Diffstat (limited to 'test/Transforms')
-rw-r--r-- | test/Transforms/DeadStoreElimination/no-targetdata.ll | 15 | ||||
-rw-r--r-- | test/Transforms/GlobalOpt/2009-06-01-RecursivePHI.ll | 7 | ||||
-rw-r--r-- | test/Transforms/GlobalOpt/heap-sra-1.ll | 16 | ||||
-rw-r--r-- | test/Transforms/GlobalOpt/heap-sra-2.ll | 14 | ||||
-rw-r--r-- | test/Transforms/GlobalOpt/heap-sra-3.ll | 14 | ||||
-rw-r--r-- | test/Transforms/GlobalOpt/heap-sra-4.ll | 14 | ||||
-rw-r--r-- | test/Transforms/GlobalOpt/heap-sra-phi.ll | 8 | ||||
-rw-r--r-- | test/Transforms/GlobalOpt/malloc-promote-1.ll | 9 | ||||
-rw-r--r-- | test/Transforms/GlobalOpt/malloc-promote-2.ll | 8 | ||||
-rw-r--r-- | test/Transforms/GlobalOpt/malloc-promote-3.ll | 8 | ||||
-rw-r--r-- | test/Transforms/JumpThreading/crash.ll | 83 |
11 files changed, 155 insertions, 41 deletions
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 +} + |