blob: 53e4c10a720a2a3365b61784ff3538e5067dd49b [file] [log] [blame]
Eli Friedman293c31b2011-08-31 21:37:06 +00001; RUN: opt < %s -ipsccp -S | FileCheck %s
2
3; This transformation is safe for atomic loads and stores; check that it works.
4
5@G = internal global i32 17
6@C = internal constant i32 222
7
8define i32 @test1() {
9 %V = load atomic i32* @G seq_cst, align 4
10 %C = icmp eq i32 %V, 17
11 br i1 %C, label %T, label %F
12T:
13 store atomic i32 17, i32* @G seq_cst, align 4
14 ret i32 %V
15F:
16 store atomic i32 123, i32* @G seq_cst, align 4
17 ret i32 0
18}
Stephen Lina76289a2013-07-14 01:50:49 +000019; CHECK-LABEL: define i32 @test1(
Eli Friedman293c31b2011-08-31 21:37:06 +000020; CHECK-NOT: store
21; CHECK: ret i32 17
22
23define i32 @test2() {
24 %V = load atomic i32* @C seq_cst, align 4
25 ret i32 %V
26}
27
Stephen Lina76289a2013-07-14 01:50:49 +000028; CHECK-LABEL: define i32 @test2(
Eli Friedman293c31b2011-08-31 21:37:06 +000029; CHECK-NOT: load
Eli Friedmancc6e9282011-09-01 21:20:11 +000030; CHECK: ret i32 222