1 ; RUN: opt < %s -instcombine -S | FileCheck %s
3 define void @test1(i32* %P) {
4 store i32 undef, i32* %P
5 store i32 123, i32* undef
6 store i32 124, i32* null
9 ; CHECK-NEXT: store i32 undef, i32* null
10 ; CHECK-NEXT: ret void
13 define void @test2(i32* %P) {
14 %X = load i32* %P ; <i32> [#uses=1]
15 %Y = add i32 %X, 0 ; <i32> [#uses=1]
19 ; CHECK-NEXT: ret void
22 ;; Simple sinking tests
25 define i32 @test3(i1 %C) {
27 br i1 %C, label %Cond, label %Cond2
30 store i32 -987654321, i32* %A
43 ; CHECK-NEXT: %storemerge = phi i32 [ 47, %Cond2 ], [ -987654321, %Cond ]
44 ; CHECK-NEXT: ret i32 %storemerge
48 define i32 @test4(i1 %C) {
51 br i1 %C, label %Cond, label %Cont
54 store i32 -987654321, i32* %A
63 ; CHECK-NEXT: %storemerge = phi i32 [ -987654321, %Cond ], [ 47, %0 ]
64 ; CHECK-NEXT: ret i32 %storemerge
68 define void @test5(i1 %C, i32* %P) {
69 store i32 47, i32* %P, align 1
70 br i1 %C, label %Cond, label %Cont
73 store i32 -987654321, i32* %P, align 1
80 ; CHECK-NEXT: %storemerge = phi i32
81 ; CHECK-NEXT: store i32 %storemerge, i32* %P, align 1
82 ; CHECK-NEXT: ret void