Eli Friedman | a917d4f | 2011-08-16 01:28:22 +0000 | [diff] [blame] | 1 | ; RUN: opt -basicaa -functionattrs -S < %s | FileCheck %s |
| 2 | |
| 3 | ; Atomic load/store to local doesn't affect whether a function is |
| 4 | ; readnone/readonly. |
| 5 | define i32 @test1(i32 %x) uwtable ssp { |
Bill Wendling | 90bc19c | 2013-02-20 07:21:42 +0000 | [diff] [blame] | 6 | ; CHECK: define i32 @test1(i32 %x) #0 { |
Eli Friedman | a917d4f | 2011-08-16 01:28:22 +0000 | [diff] [blame] | 7 | entry: |
| 8 | %x.addr = alloca i32, align 4 |
| 9 | store atomic i32 %x, i32* %x.addr seq_cst, align 4 |
| 10 | %r = load atomic i32* %x.addr seq_cst, align 4 |
| 11 | ret i32 %r |
| 12 | } |
| 13 | |
| 14 | ; A function with an Acquire load is not readonly. |
| 15 | define i32 @test2(i32* %x) uwtable ssp { |
Nick Lewycky | c2ec072 | 2013-07-06 00:29:58 +0000 | [diff] [blame] | 16 | ; CHECK: define i32 @test2(i32* nocapture readonly %x) #1 { |
Eli Friedman | a917d4f | 2011-08-16 01:28:22 +0000 | [diff] [blame] | 17 | entry: |
| 18 | %r = load atomic i32* %x seq_cst, align 4 |
| 19 | ret i32 %r |
| 20 | } |
| 21 | |
Bill Wendling | 90bc19c | 2013-02-20 07:21:42 +0000 | [diff] [blame] | 22 | ; CHECK: attributes #0 = { readnone ssp uwtable } |
| 23 | ; CHECK: attributes #1 = { ssp uwtable } |