1 ; RUN: opt -S -passes=adce < %s | FileCheck %s
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.
8 declare void @readonly_function() readonly nounwind willreturn
9 declare void @readnone_function() readnone nounwind willreturn
11 define void @test0() {
12 ; CHECK-LABEL: @test0(
14 call void @readonly_function() [ "tag"() ]
15 ; CHECK: call void @readonly_function
19 define void @test1() {
20 ; CHECK-LABEL: @test1(
22 call void @readnone_function() [ "tag"() ]
23 ; CHECK: call void @readnone_function
27 define void @test2() {
28 ; CHECK-LABEL: @test2(
30 ; CHECK-NOT: @readonly_function(
31 call void @readonly_function() readonly [ "tag"() ]
35 define void @test3() {
36 ; CHECK-LABEL: @test3(
38 ; CHECK-NOT: @readnone_function(
39 call void @readnone_function() readnone [ "tag"() ]
43 define void @test4() {
44 ; CHECK-LABEL: @test4(
46 ; CHECK-NOT: @readonly_function()
47 call void @readonly_function() [ "deopt"() ]