1; RUN: opt -basic-aa -function-attrs -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.
6define i32 @test1(i32 %x) uwtable ssp {
7; CHECK: define i32 @test1(i32 %x) #0 {
8entry:
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.
16define i32 @test2(i32* %x) uwtable ssp {
17; CHECK: define i32 @test2(i32* nocapture readonly %x) #1 {
18entry:
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 }
24; CHECK: attributes #1 = { nofree norecurse nounwind ssp uwtable }
25