llvm.org GIT mirror llvm / 24adac8
Add tests for the transformations SCCP can do on atomic loads and stores (which are safe without any modifications). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138902 91177308-0d34-0410-b5e6-96231b3b80d8 Eli Friedman 8 years ago
1 changed file(s) with 30 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 ; RUN: opt < %s -ipsccp -S | FileCheck %s
1
2 ; This transformation is safe for atomic loads and stores; check that it works.
3
4 @G = internal global i32 17
5 @C = internal constant i32 222
6
7 define i32 @test1() {
8 %V = load atomic i32* @G seq_cst, align 4
9 %C = icmp eq i32 %V, 17
10 br i1 %C, label %T, label %F
11 T:
12 store atomic i32 17, i32* @G seq_cst, align 4
13 ret i32 %V
14 F:
15 store atomic i32 123, i32* @G seq_cst, align 4
16 ret i32 0
17 }
18 ; CHECK: define i32 @test1
19 ; CHECK-NOT: store
20 ; CHECK: ret i32 17
21
22 define i32 @test2() {
23 %V = load atomic i32* @C seq_cst, align 4
24 ret i32 %V
25 }
26
27 ; CHECK: define i32 @test2
28 ; CHECK-NOT: load
29 ; CHECK: ret i32 222