blob: 35de0ce800deefb3715e859426c6dfd61c19ab38 [file] [log] [blame]
Eric Christophercee313d2019-04-17 04:52:47 +00001; 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.
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 }
Brian Homerdingb4b21d82019-07-08 15:57:56 +000024; CHECK: attributes #1 = { nofree norecurse nounwind ssp uwtable }