1; XFAIL: * 2 3; RUN: opt -S -basic-aa -dse < %s | FileCheck %s 4 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 10define void @test3(i32* byval(i32) %addr.i) { 11; CHECK-LABEL: @test3 12; CHECK-NOT: store 13; CHECK: fence 14; CHECK: ret 15 store i32 5, i32* %addr.i, align 4 16 fence release 17 ret void 18} 19 20declare void @foo(i8* nocapture %p) 21 22declare noalias i8* @malloc(i32) 23 24; DSE of stores in locations allocated through library calls. 25define void @test_nocapture() { 26; CHECK-LABEL: @test_nocapture 27; CHECK: malloc 28; CHECK: foo 29; CHECK-NOT: store 30; CHECK: fence 31 %m = call i8* @malloc(i32 24) 32 call void @foo(i8* %m) 33 store i8 4, i8* %m 34 fence release 35 ret void 36} 37 38 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. 41define void @fence_seq_cst() { 42; CHECK-LABEL: @fence_seq_cst 43; CHECK-NEXT: fence seq_cst 44; CHECK-NEXT: ret void 45 %P1 = alloca i32 46 store i32 0, i32* %P1, align 4 47 fence seq_cst 48 store i32 4, i32* %P1, align 4 49 ret void 50} 51