xref: /llvm-project/llvm/test/Transforms/FunctionAttrs/2008-09-03-ReadNone.ll (revision 304f1d59ca41872c094def3aee0a8689df6aa398)
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-attributes
2; RUN: opt < %s -passes=function-attrs -S | FileCheck %s
3
4@x = global i32 0
5
6declare i32 @e() readnone
7
8define i32 @f() {
9; CHECK: Function Attrs: nofree nosync memory(none)
10; CHECK-LABEL: @f(
11; CHECK-NEXT:    [[TMP:%.*]] = call i32 @e()
12; CHECK-NEXT:    ret i32 [[TMP]]
13;
14  %tmp = call i32 @e()
15  ret i32 %tmp
16}
17
18define i32 @g() readonly {
19; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
20; CHECK-LABEL: @g(
21; CHECK-NEXT:    ret i32 0
22;
23  ret i32 0
24}
25
26define i32 @h() readnone {
27; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
28; CHECK-LABEL: @h(
29; CHECK-NEXT:    [[TMP:%.*]] = load i32, ptr @x, align 4
30; CHECK-NEXT:    ret i32 [[TMP]]
31;
32  %tmp = load i32, ptr @x
33  ret i32 %tmp
34}
35