1 ; RUN: opt < %s -passes=dse -S | FileCheck %s
3 declare noalias ptr @malloc(i64) "malloc-like"
9 %obj = call ptr @malloc(i64 8)
11 ; don't remove store. %obj should be treated like it will be read by the @foo.
12 ; CHECK: store i8 0, ptr %obj
13 call void @foo() ["deopt" (ptr %obj)]
17 define void @test1() {
18 %obj = call ptr @malloc(i64 8)
20 ; CHECK: store i8 0, ptr %obj
21 call void @bar(ptr nocapture %obj)
25 define void @test2() {
26 %obj = call ptr @malloc(i64 8)
28 ; CHECK-NOT: store i8 0, ptr %obj
33 define void @test3() {
34 ; CHECK-LABEL: @test3(
36 ; Verify that this first store is not considered killed by the second one
37 ; since it could be observed from the deopt continuation.
38 ; CHECK: store i64 1, ptr %s
40 call void @foo() [ "deopt"(ptr %s) ]
45 declare noalias ptr @calloc(i64, i64) inaccessiblememonly allockind("alloc,zeroed")
47 define void @test4() {
49 %local_obj = call ptr @calloc(i64 1, i64 4)
50 call void @foo() ["deopt" (ptr %local_obj)]
51 store i8 0, ptr %local_obj, align 4
52 ; CHECK-NOT: store i8 0, ptr %local_obj, align 4
53 call void @bar(ptr nocapture %local_obj)