blob: d5a8db7d53b9843eb2c03edf54c32d47f5cae4ca [file] [log] [blame]
Eli Friedmana917d4f2011-08-16 01:28:22 +00001; 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.
5define i32 @test1(i32 %x) uwtable ssp {
Bill Wendling90bc19c2013-02-20 07:21:42 +00006; CHECK: define i32 @test1(i32 %x) #0 {
Eli Friedmana917d4f2011-08-16 01:28:22 +00007entry:
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.
15define i32 @test2(i32* %x) uwtable ssp {
Nick Lewyckyc2ec0722013-07-06 00:29:58 +000016; CHECK: define i32 @test2(i32* nocapture readonly %x) #1 {
Eli Friedmana917d4f2011-08-16 01:28:22 +000017entry:
18 %r = load atomic i32* %x seq_cst, align 4
19 ret i32 %r
20}
21
Bill Wendling90bc19c2013-02-20 07:21:42 +000022; CHECK: attributes #0 = { readnone ssp uwtable }
23; CHECK: attributes #1 = { ssp uwtable }