1*9880d681SAndroid Build Coastguard Worker; RUN: opt -S -functionattrs < %s | FileCheck %s 2*9880d681SAndroid Build Coastguard Worker 3*9880d681SAndroid Build Coastguard Workerdeclare void @f_readonly() readonly 4*9880d681SAndroid Build Coastguard Workerdeclare void @f_readnone() readnone 5*9880d681SAndroid Build Coastguard Worker 6*9880d681SAndroid Build Coastguard Workerdefine void @test_0(i32* %x) { 7*9880d681SAndroid Build Coastguard Worker; FunctionAttrs must not infer readonly / readnone for %x 8*9880d681SAndroid Build Coastguard Worker 9*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: define void @test_0(i32* %x) { 10*9880d681SAndroid Build Coastguard Worker entry: 11*9880d681SAndroid Build Coastguard Worker ; CHECK: call void @f_readonly() [ "foo"(i32* %x) ] 12*9880d681SAndroid Build Coastguard Worker call void @f_readonly() [ "foo"(i32* %x) ] 13*9880d681SAndroid Build Coastguard Worker ret void 14*9880d681SAndroid Build Coastguard Worker} 15*9880d681SAndroid Build Coastguard Worker 16*9880d681SAndroid Build Coastguard Workerdefine void @test_1(i32* %x) { 17*9880d681SAndroid Build Coastguard Worker; FunctionAttrs must not infer readonly / readnone for %x 18*9880d681SAndroid Build Coastguard Worker 19*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: define void @test_1(i32* %x) { 20*9880d681SAndroid Build Coastguard Worker entry: 21*9880d681SAndroid Build Coastguard Worker ; CHECK: call void @f_readnone() [ "foo"(i32* %x) ] 22*9880d681SAndroid Build Coastguard Worker call void @f_readnone() [ "foo"(i32* %x) ] 23*9880d681SAndroid Build Coastguard Worker ret void 24*9880d681SAndroid Build Coastguard Worker} 25*9880d681SAndroid Build Coastguard Worker 26*9880d681SAndroid Build Coastguard Workerdefine void @test_2(i32* %x) { 27*9880d681SAndroid Build Coastguard Worker; The "deopt" operand bundle does not capture or write to %x. 28*9880d681SAndroid Build Coastguard Worker 29*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: define void @test_2(i32* nocapture readonly %x) 30*9880d681SAndroid Build Coastguard Worker entry: 31*9880d681SAndroid Build Coastguard Worker call void @f_readonly() [ "deopt"(i32* %x) ] 32*9880d681SAndroid Build Coastguard Worker ret void 33*9880d681SAndroid Build Coastguard Worker} 34