1 ; RUN: opt < %s -basicaa -dse -S | FileCheck %s
3 declare noalias i8* @malloc(i64) "malloc-like"
9 %obj = call i8* @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, i8* %obj
13 call void @foo() ["deopt" (i8* %obj)]
17 define void @test1() {
18 %obj = call i8* @malloc(i64 8)
20 ; CHECK: store i8 0, i8* %obj
21 call void @bar(i8* nocapture %obj)
25 define void @test2() {
26 %obj = call i8* @malloc(i64 8)
28 ; CHECK-NOT: store i8 0, i8* %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, i64* %s
40 call void @foo() [ "deopt"(i64* %s) ]
45 declare noalias i8* @calloc(i64, i64)
47 define void @test4() {
49 %local_obj = call i8* @calloc(i64 1, i64 4)
50 call void @foo() ["deopt" (i8* %local_obj)]
51 store i8 0, i8* %local_obj, align 4
52 ; CHECK-NOT: store i8 0, i8* %local_obj, align 4
53 call void @bar(i8* nocapture %local_obj)