1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --scrub-attributes
2; RUN: opt -attributor -attributor-manifest-internal -attributor-disable=false -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=3 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM
3; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-disable=false -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=3 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM
4; RUN: opt -attributor-cgscc -attributor-manifest-internal -attributor-disable=false -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM
5; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-disable=false -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM
6
7define void @f() {
8; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@f()
9; IS__TUNIT_OPM-NEXT:  entry:
10; IS__TUNIT_OPM-NEXT:    [[A:%.*]] = alloca i32, align 1
11; IS__TUNIT_OPM-NEXT:    call void @g(i32* noalias nocapture nonnull readonly dereferenceable(4) [[A]])
12; IS__TUNIT_OPM-NEXT:    ret void
13;
14; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@f()
15; IS__TUNIT_NPM-NEXT:  entry:
16; IS__TUNIT_NPM-NEXT:    [[A:%.*]] = alloca i32, align 1
17; IS__TUNIT_NPM-NEXT:    [[TMP0:%.*]] = load i32, i32* [[A]], align 1
18; IS__TUNIT_NPM-NEXT:    call void @g(i32 [[TMP0]])
19; IS__TUNIT_NPM-NEXT:    ret void
20;
21; IS__CGSCC____-LABEL: define {{[^@]+}}@f()
22; IS__CGSCC____-NEXT:  entry:
23; IS__CGSCC____-NEXT:    [[A:%.*]] = alloca i32, align 1
24; IS__CGSCC____-NEXT:    call void @g(i32* noalias nonnull readonly dereferenceable(4) [[A]])
25; IS__CGSCC____-NEXT:    ret void
26;
27entry:
28  %a = alloca i32, align 1
29  call void @g(i32* %a)
30  ret void
31}
32
33define internal void @g(i32* %a) {
34; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@g
35; IS__TUNIT_OPM-SAME: (i32* noalias nocapture nonnull readonly dereferenceable(4) [[A:%.*]])
36; IS__TUNIT_OPM-NEXT:    [[AA:%.*]] = load i32, i32* [[A]], align 1
37; IS__TUNIT_OPM-NEXT:    call void @z(i32 [[AA]])
38; IS__TUNIT_OPM-NEXT:    ret void
39;
40; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@g
41; IS__TUNIT_NPM-SAME: (i32 [[TMP0:%.*]])
42; IS__TUNIT_NPM-NEXT:    [[A_PRIV:%.*]] = alloca i32
43; IS__TUNIT_NPM-NEXT:    store i32 [[TMP0]], i32* [[A_PRIV]]
44; IS__TUNIT_NPM-NEXT:    [[AA:%.*]] = load i32, i32* [[A_PRIV]], align 1
45; IS__TUNIT_NPM-NEXT:    call void @z(i32 [[AA]])
46; IS__TUNIT_NPM-NEXT:    ret void
47;
48; IS__CGSCC____-LABEL: define {{[^@]+}}@g
49; IS__CGSCC____-SAME: (i32* nocapture nonnull readonly dereferenceable(4) [[A:%.*]])
50; IS__CGSCC____-NEXT:    [[AA:%.*]] = load i32, i32* [[A]], align 1
51; IS__CGSCC____-NEXT:    call void @z(i32 [[AA]])
52; IS__CGSCC____-NEXT:    ret void
53;
54  %aa = load i32, i32* %a, align 1
55  call void @z(i32 %aa)
56  ret void
57}
58
59declare void @z(i32)
60