Sanjoy Das | 71fe81f | 2015-11-07 01:56:00 +0000 | [diff] [blame] | 1 | ; RUN: opt -S -functionattrs < %s | FileCheck %s |
| 2 | |
| 3 | declare void @f_readonly() readonly |
| 4 | declare void @f_readnone() readnone |
| 5 | |
| 6 | define void @test_0(i32* %x) { |
| 7 | ; FunctionAttrs must not infer readonly / readnone for %x |
| 8 | |
| 9 | ; CHECK-LABEL: define void @test_0(i32* %x) { |
| 10 | entry: |
| 11 | ; CHECK: call void @f_readonly() [ "foo"(i32* %x) ] |
| 12 | call void @f_readonly() [ "foo"(i32* %x) ] |
| 13 | ret void |
| 14 | } |
| 15 | |
| 16 | define void @test_1(i32* %x) { |
| 17 | ; FunctionAttrs must not infer readonly / readnone for %x |
| 18 | |
| 19 | ; CHECK-LABEL: define void @test_1(i32* %x) { |
| 20 | entry: |
| 21 | ; CHECK: call void @f_readnone() [ "foo"(i32* %x) ] |
| 22 | call void @f_readnone() [ "foo"(i32* %x) ] |
| 23 | ret void |
| 24 | } |
Sanjoy Das | bcd1503 | 2015-11-26 01:16:05 +0000 | [diff] [blame] | 25 | |
| 26 | define void @test_2(i32* %x) { |
| 27 | ; The "deopt" operand bundle does not capture or write to %x. |
| 28 | |
| 29 | ; CHECK-LABEL: define void @test_2(i32* nocapture readonly %x) |
| 30 | entry: |
| 31 | call void @f_readonly() [ "deopt"(i32* %x) ] |
| 32 | ret void |
| 33 | } |