1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 20:12:56 +02:00

merge a test into store.ll

llvm-svn: 85771
This commit is contained in:
Chris Lattner 2009-11-02 02:00:18 +00:00
parent 0eaddd9187
commit 96bfb792af
2 changed files with 45 additions and 37 deletions

View File

@ -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
}

View File

@ -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
}