| Eric Christopher | cee313d | 2019-04-17 04:52:47 +0000 | [diff] [blame] | 1 | ; RUN: opt -basicaa -functionattrs -S < %s | FileCheck %s |
| 2 | ; RUN: opt -aa-pipeline=basic-aa -passes=function-attrs -S < %s | FileCheck %s |
| 3 | |
| 4 | ; Atomic load/store to local doesn't affect whether a function is |
| 5 | ; readnone/readonly. |
| 6 | define i32 @test1(i32 %x) uwtable ssp { |
| 7 | ; CHECK: define i32 @test1(i32 %x) #0 { |
| 8 | entry: |
| 9 | %x.addr = alloca i32, align 4 |
| 10 | store atomic i32 %x, i32* %x.addr seq_cst, align 4 |
| 11 | %r = load atomic i32, i32* %x.addr seq_cst, align 4 |
| 12 | ret i32 %r |
| 13 | } |
| 14 | |
| 15 | ; A function with an Acquire load is not readonly. |
| 16 | define i32 @test2(i32* %x) uwtable ssp { |
| 17 | ; CHECK: define i32 @test2(i32* nocapture readonly %x) #1 { |
| 18 | entry: |
| 19 | %r = load atomic i32, i32* %x seq_cst, align 4 |
| 20 | ret i32 %r |
| 21 | } |
| 22 | |
| 23 | ; CHECK: attributes #0 = { norecurse nounwind readnone ssp uwtable } |
| Brian Homerding | b4b21d8 | 2019-07-08 15:57:56 +0000 | [diff] [blame] | 24 | ; CHECK: attributes #1 = { nofree norecurse nounwind ssp uwtable } |