34 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-attributes2; RUN: opt -passes=function-attrs -S < %s | FileCheck %s3 4; Atomic load/store to local doesn't affect whether a function is5; readnone/readonly.6define i32 @test1(i32 %x) uwtable ssp {7; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind ssp willreturn memory(none) uwtable8; CHECK-LABEL: @test1(9; CHECK-NEXT: entry:10; CHECK-NEXT: [[X_ADDR:%.*]] = alloca i32, align 411; CHECK-NEXT: store atomic i32 [[X:%.*]], ptr [[X_ADDR]] seq_cst, align 412; CHECK-NEXT: [[R:%.*]] = load atomic i32, ptr [[X_ADDR]] seq_cst, align 413; CHECK-NEXT: ret i32 [[R]]14;15entry:16 %x.addr = alloca i32, align 417 store atomic i32 %x, ptr %x.addr seq_cst, align 418 %r = load atomic i32, ptr %x.addr seq_cst, align 419 ret i32 %r20}21 22; A function with an Acquire load is not readonly.23define i32 @test2(ptr %x) uwtable ssp {24; CHECK: Function Attrs: mustprogress nofree norecurse nounwind ssp willreturn memory(argmem: readwrite) uwtable25; CHECK-LABEL: @test2(26; CHECK-NEXT: entry:27; CHECK-NEXT: [[R:%.*]] = load atomic i32, ptr [[X:%.*]] seq_cst, align 428; CHECK-NEXT: ret i32 [[R]]29;30entry:31 %r = load atomic i32, ptr %x seq_cst, align 432 ret i32 %r33}34