1 ; RUN: opt -S -passes=dse < %s | FileCheck %s
3 ; We conservative choose to prevent dead store elimination
4 ; across release or stronger fences. It's not required
5 ; (since the must still be a race on %addd.i), but
6 ; it is conservatively correct. A legal optimization
7 ; could hoist the second store above the fence, and then
9 define void @test1(ptr %addr.i) {
15 store i32 5, ptr %addr.i, align 4
17 store i32 5, ptr %addr.i, align 4
21 ; Same as previous, but with different values. If we ever optimize
22 ; this more aggressively, this allows us to check that the correct
23 ; store is retained (the 'i32 1' store in this case)
24 define void @test1b(ptr %addr.i) {
25 ; CHECK-LABEL: @test1b
27 ; CHECK: fence release
30 store i32 42, ptr %addr.i, align 4
32 store i32 1, ptr %addr.i, align 4
36 ; We *could* DSE across this fence, but don't. No other thread can
37 ; observe the order of the acquire fence and the store.
38 define void @test2(ptr %addr.i) {
44 store i32 5, ptr %addr.i, align 4
46 store i32 5, ptr %addr.i, align 4