1; RUN: opt -S -adce < %s | FileCheck %s
2
3; While it is normally okay to DCE out calls to @readonly_function and
4; @readnone_function, we cannot do that if they're carrying operand
5; bundles since the presence of unknown operand bundles implies
6; arbitrary memory effects.
7
8declare void @readonly_function() readonly nounwind
9declare void @readnone_function() readnone nounwind
10
11define void @test0() {
12; CHECK-LABEL: @test0(
13 entry:
14  call void @readonly_function() [ "tag"() ]
15; CHECK: call void @readonly_function
16  ret void
17}
18
19define void @test1() {
20; CHECK-LABEL: @test1(
21 entry:
22  call void @readnone_function() [ "tag"() ]
23; CHECK: call void @readnone_function
24  ret void
25}
26
27define void @test2() {
28; CHECK-LABEL: @test2(
29 entry:
30; CHECK-NOT: @readonly_function(
31  call void @readonly_function() readonly [ "tag"() ]
32  ret void
33}
34
35define void @test3() {
36; CHECK-LABEL: @test3(
37 entry:
38; CHECK-NOT: @readnone_function(
39  call void @readnone_function() readnone [ "tag"() ]
40  ret void
41}
42
43define void @test4() {
44; CHECK-LABEL: @test4(
45 entry:
46; CHECK-NOT: @readonly_function()
47  call void @readonly_function() [ "deopt"() ]
48  ret void
49}
50