blob: 45b5d7c80feb3719e5b3a63b4d88ae489d3addf6 [file] [log] [blame]
Eric Christophercee313d2019-04-17 04:52:47 +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, 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}
19; CHECK-LABEL: define i32 @test1(
20; CHECK-NOT: store
21; CHECK: ret i32 17
22
23define i32 @test2() {
24 %V = load atomic i32, i32* @C seq_cst, align 4
25 ret i32 %V
26}
27
28; CHECK-LABEL: define i32 @test2(
29; CHECK-NOT: load
30; CHECK: ret i32 222