llvm.org GIT mirror llvm / a1e80a1
CHECK-LABELize test git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217797 91177308-0d34-0410-b5e6-96231b3b80d8 Matt Arsenault 5 years ago
2 changed file(s) with 19 addition(s) and 19 deletion(s). Raw diff Collapse all Expand all
None ; Test that GCSE uses basicaa to do alias analysis, which is capable of
1 ; disambiguating some obvious cases. All loads should be removable in
0 ; Test that GCSE uses basicaa to do alias analysis, which is capable of
1 ; disambiguating some obvious cases. All loads should be removable in
22 ; this testcase.
33
44 ; RUN: opt < %s -basicaa -gvn -instcombine -dce -S | FileCheck %s
77 define i32 @test0(i8* %P) {
88 %A = alloca i32
99 call void @external(i32* %A)
10
10
1111 store i32 0, i32* %A
12
12
1313 call void @llvm.memset.p0i8.i32(i8* %P, i8 0, i32 42, i32 1, i1 false)
14
14
1515 %B = load i32* %A
1616 ret i32 %B
17
18 ; CHECK: @test0
17
18 ; CHECK-LABEL: @test0
1919 ; CHECK: ret i32 0
2020 }
2121
2222 define i8 @test1() {
23 ; CHECK: @test1
23 ; CHECK-LABEL: @test1
2424 %A = alloca i8
2525 %B = alloca i8
2626
3434 }
3535
3636 define i8 @test2(i8* %P) {
37 ; CHECK: @test2
37 ; CHECK-LABEL: @test2
3838 %P2 = getelementptr i8* %P, i32 127
3939 store i8 1, i8* %P2 ;; Not dead across memset
4040 call void @llvm.memset.p0i8.i8(i8* %P, i8 2, i8 127, i32 0, i1 false)
4444 }
4545
4646 define i8 @test2a(i8* %P) {
47 ; CHECK: @test2
47 ; CHECK-LABEL: @test2
4848 %P2 = getelementptr i8* %P, i32 126
49
49
5050 ;; FIXME: DSE isn't zapping this dead store.
5151 store i8 1, i8* %P2 ;; Dead, clobbered by memset.
52
52
5353 call void @llvm.memset.p0i8.i8(i8* %P, i8 2, i8 127, i32 0, i1 false)
5454 %A = load i8* %P2
5555 ret i8 %A
5858 }
5959
6060 define void @test3(i8* %P, i8 %X) {
61 ; CHECK: @test3
61 ; CHECK-LABEL: @test3
6262 ; CHECK-NOT: store
6363 ; CHECK-NOT: %Y
6464 %Y = add i8 %X, 1 ;; Dead, because the only use (the store) is dead.
65
65
6666 %P2 = getelementptr i8* %P, i32 2
6767 store i8 %Y, i8* %P2 ;; Not read by lifetime.end, should be removed.
6868 ; CHECK: store i8 2, i8* %P2
7474 }
7575
7676 define void @test3a(i8* %P, i8 %X) {
77 ; CHECK: @test3a
77 ; CHECK-LABEL: @test3a
7878 %Y = add i8 %X, 1 ;; Dead, because the only use (the store) is dead.
79
79
8080 %P2 = getelementptr i8* %P, i32 2
8181 store i8 %Y, i8* %P2
8282 ; CHECK-NEXT: call void @llvm.lifetime.end
9494 %tmp2 = load i32* @G1
9595 %sub = sub i32 %tmp2, %tmp
9696 ret i32 %sub
97 ; CHECK: @test4
97 ; CHECK-LABEL: @test4
9898 ; CHECK-NOT: load
9999 ; CHECK: memset.p0i8.i32
100100 ; CHECK-NOT: load
122122 %y = load i8* %a
123123 %z = add i8 %x, %y
124124 ret i8 %z
125 ; CHECK: @test6
125 ; CHECK-LABEL: @test6
126126 ; CHECK: load i8* %a
127127 ; CHECK-NOT: load
128128 ; CHECK: ret
138138 call void @test7decl(i32* %add.ptr)
139139 %tmp = load i32* %x, align 4
140140 ret i32 %tmp
141 ; CHECK: @test7(
141 ; CHECK-LABEL: @test7(
142142 ; CHECK: store i32 0
143143 ; CHECK: call void @test7decl
144144 ; CHECK: load i32*