3 ; RUN: opt -S -passes=dse < %s | FileCheck %s
5 ; We DSE stack alloc'ed and byval locations, in the presence of fences.
6 ; Fence does not make an otherwise thread local store visible.
7 ; Right now the DSE in presence of fence is only done in end blocks (with no successors),
8 ; but the same logic applies to other basic blocks as well.
9 ; The store to %addr.i can be removed since it is a byval attribute
10 define void @test3(ptr byval(i32) %addr.i) {
15 store i32 5, ptr %addr.i, align 4
20 declare void @foo(ptr nocapture %p)
22 declare noalias ptr @malloc(i32)
24 ; DSE of stores in locations allocated through library calls.
25 define void @test_nocapture() {
26 ; CHECK-LABEL: @test_nocapture
31 %m = call ptr @malloc(i32 24)
32 call void @foo(ptr %m)
39 ; This is a full fence, but it does not make a thread local store visible.
40 ; We can DSE the store in presence of the fence.
41 define void @fence_seq_cst() {
42 ; CHECK-LABEL: @fence_seq_cst
43 ; CHECK-NEXT: fence seq_cst
44 ; CHECK-NEXT: ret void
46 store i32 0, ptr %P1, align 4
48 store i32 4, ptr %P1, align 4