diff options
author | Chris Lattner <sabre@nondot.org> | 2006-09-13 19:23:43 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-09-13 19:23:43 +0000 |
commit | 54ae241ed4c986e59ba4e1d6ac0e1ce6d66b0a71 (patch) | |
tree | 0b350d70b74000ecee52da466e2a898a951a38dc | |
parent | 80543c83057622884d86dd8758a6d560c41e9a8b (diff) |
new testcase
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30302 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | test/Transforms/Inline/inline_cleanup.ll | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/test/Transforms/Inline/inline_cleanup.ll b/test/Transforms/Inline/inline_cleanup.ll new file mode 100644 index 0000000000..a26045061d --- /dev/null +++ b/test/Transforms/Inline/inline_cleanup.ll @@ -0,0 +1,65 @@ +; Test that the inliner doesn't leave around dead allocas, and that it folds +; uncond branches away after it is done specializing. + +; RUN: llvm-as < %s | opt -inline -disable-output && +; RUN: llvm-as < %s | opt -inline | llvm-dis | not grep 'alloca.*uses=0' && +; RUN: llvm-as < %s | opt -inline | llvm-dis | not grep 'br label' + +%A = weak global int 0 ; <int*> [#uses=1] +%B = weak global int 0 ; <int*> [#uses=1] +%C = weak global int 0 ; <int*> [#uses=1] + +implementation ; Functions: + +internal fastcc void %foo(int %X) { +entry: + %ALL = alloca int, align 4 ; <int*> [#uses=1] + %tmp1 = and int %X, 1 ; <int> [#uses=1] + %tmp1 = seteq int %tmp1, 0 ; <bool> [#uses=1] + br bool %tmp1, label %cond_next, label %cond_true + +cond_true: ; preds = %entry + store int 1, int* %A + br label %cond_next + +cond_next: ; preds = %entry, %cond_true + %tmp4 = and int %X, 2 ; <int> [#uses=1] + %tmp4 = seteq int %tmp4, 0 ; <bool> [#uses=1] + br bool %tmp4, label %cond_next7, label %cond_true5 + +cond_true5: ; preds = %cond_next + store int 1, int* %B + br label %cond_next7 + +cond_next7: ; preds = %cond_next, %cond_true5 + %tmp10 = and int %X, 4 ; <int> [#uses=1] + %tmp10 = seteq int %tmp10, 0 ; <bool> [#uses=1] + br bool %tmp10, label %cond_next13, label %cond_true11 + +cond_true11: ; preds = %cond_next7 + store int 1, int* %C + br label %cond_next13 + +cond_next13: ; preds = %cond_next7, %cond_true11 + %tmp16 = and int %X, 8 ; <int> [#uses=1] + %tmp16 = seteq int %tmp16, 0 ; <bool> [#uses=1] + br bool %tmp16, label %UnifiedReturnBlock, label %cond_true17 + +cond_true17: ; preds = %cond_next13 + call void %ext( int* %ALL ) + ret void + +UnifiedReturnBlock: ; preds = %cond_next13 + ret void +} + +declare void %ext(int*) + +void %test() { +entry: + tail call fastcc void %foo( int 1 ) + tail call fastcc void %foo( int 2 ) + tail call fastcc void %foo( int 3 ) + tail call fastcc void %foo( int 8 ) + ret void +} |