diff options
author | Chris Lattner <sabre@nondot.org> | 2009-11-02 02:00:18 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-11-02 02:00:18 +0000 |
commit | f013eea9727d64c87a73944ce2099c648cb6de6c (patch) | |
tree | c39395bb79fcf2dc0a04a2390491d62da92e6970 /test/Transforms/InstCombine | |
parent | f7956621eedaad23888c9b67db505e1173dec390 (diff) | |
download | external_llvm-f013eea9727d64c87a73944ce2099c648cb6de6c.zip external_llvm-f013eea9727d64c87a73944ce2099c648cb6de6c.tar.gz external_llvm-f013eea9727d64c87a73944ce2099c648cb6de6c.tar.bz2 |
merge a test into store.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85771 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/InstCombine')
-rw-r--r-- | test/Transforms/InstCombine/store-merge.ll | 37 | ||||
-rw-r--r-- | test/Transforms/InstCombine/store.ll | 45 |
2 files changed, 45 insertions, 37 deletions
diff --git a/test/Transforms/InstCombine/store-merge.ll b/test/Transforms/InstCombine/store-merge.ll deleted file mode 100644 index 06d497d..0000000 --- a/test/Transforms/InstCombine/store-merge.ll +++ /dev/null @@ -1,37 +0,0 @@ -; RUN: opt < %s -instcombine -S | \ -; RUN: grep {ret i32 %.toremerge} | count 2 -;; Simple sinking tests - -; "if then else" -define i32 @test1(i1 %C) { - %A = alloca i32 - br i1 %C, label %Cond, label %Cond2 - -Cond: - store i32 -987654321, i32* %A - br label %Cont - -Cond2: - store i32 47, i32* %A - br label %Cont - -Cont: - %V = load i32* %A - ret i32 %V -} - -; "if then" -define i32 @test2(i1 %C) { - %A = alloca i32 - store i32 47, i32* %A - br i1 %C, label %Cond, label %Cont - -Cond: - store i32 -987654321, i32* %A - br label %Cont - -Cont: - %V = load i32* %A - ret i32 %V -} - diff --git a/test/Transforms/InstCombine/store.ll b/test/Transforms/InstCombine/store.ll index 3b8c0ab..54f1621 100644 --- a/test/Transforms/InstCombine/store.ll +++ b/test/Transforms/InstCombine/store.ll @@ -19,3 +19,48 @@ define void @test2(i32* %P) { ; CHECK-NEXT: ret void } +;; Simple sinking tests + +; "if then else" +define i32 @test3(i1 %C) { + %A = alloca i32 + br i1 %C, label %Cond, label %Cond2 + +Cond: + store i32 -987654321, i32* %A + br label %Cont + +Cond2: + store i32 47, i32* %A + br label %Cont + +Cont: + %V = load i32* %A + ret i32 %V +; CHECK: @test3 +; CHECK-NOT: alloca +; CHECK: Cont: +; CHECK-NEXT: %storemerge = phi i32 [ 47, %Cond2 ], [ -987654321, %Cond ] +; CHECK-NEXT: ret i32 %storemerge +} + +; "if then" +define i32 @test4(i1 %C) { + %A = alloca i32 + store i32 47, i32* %A + br i1 %C, label %Cond, label %Cont + +Cond: + store i32 -987654321, i32* %A + br label %Cont + +Cont: + %V = load i32* %A + ret i32 %V +; CHECK: @test4 +; CHECK-NOT: alloca +; CHECK: Cont: +; CHECK-NEXT: %storemerge = phi i32 [ -987654321, %Cond ], [ 47, %0 ] +; CHECK-NEXT: ret i32 %storemerge +} + |