• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes
2; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal  -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=4 -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-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=4 -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 -enable-new-pm=0 -attributor-manifest-internal  -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-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
7target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
8target triple = "x86_64-pc-windows-msvc"
9
10define internal void @add({i32, i32}* %this, i32* sret(i32) %r) {
11;
12; IS__TUNIT_OPM: Function Attrs: argmemonly nofree nosync nounwind willreturn
13; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@add
14; IS__TUNIT_OPM-SAME: ({ i32, i32 }* nocapture nofree noundef nonnull readonly align 8 dereferenceable(8) [[THIS:%.*]], i32* nocapture nofree noundef nonnull writeonly sret(i32) align 4 dereferenceable(4) [[R:%.*]]) [[ATTR0:#.*]] {
15; IS__TUNIT_OPM-NEXT:    [[AP:%.*]] = getelementptr { i32, i32 }, { i32, i32 }* [[THIS]], i32 0, i32 0
16; IS__TUNIT_OPM-NEXT:    [[BP:%.*]] = getelementptr { i32, i32 }, { i32, i32 }* [[THIS]], i32 0, i32 1
17; IS__TUNIT_OPM-NEXT:    [[A:%.*]] = load i32, i32* [[AP]], align 8
18; IS__TUNIT_OPM-NEXT:    [[B:%.*]] = load i32, i32* [[BP]], align 4
19; IS__TUNIT_OPM-NEXT:    [[AB:%.*]] = add i32 [[A]], [[B]]
20; IS__TUNIT_OPM-NEXT:    store i32 [[AB]], i32* [[R]], align 4
21; IS__TUNIT_OPM-NEXT:    ret void
22;
23; IS__TUNIT_NPM: Function Attrs: argmemonly nofree nosync nounwind willreturn
24; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@add
25; IS__TUNIT_NPM-SAME: ({ i32, i32 }* noalias nocapture nofree noundef nonnull readonly align 8 dereferenceable(8) [[THIS:%.*]], i32* noalias nocapture nofree noundef nonnull writeonly sret(i32) align 4 dereferenceable(4) [[R:%.*]]) [[ATTR0:#.*]] {
26; IS__TUNIT_NPM-NEXT:    [[AP:%.*]] = getelementptr { i32, i32 }, { i32, i32 }* [[THIS]], i32 0, i32 0
27; IS__TUNIT_NPM-NEXT:    [[BP:%.*]] = getelementptr { i32, i32 }, { i32, i32 }* [[THIS]], i32 0, i32 1
28; IS__TUNIT_NPM-NEXT:    [[A:%.*]] = load i32, i32* [[AP]], align 8
29; IS__TUNIT_NPM-NEXT:    [[B:%.*]] = load i32, i32* [[BP]], align 4
30; IS__TUNIT_NPM-NEXT:    [[AB:%.*]] = add i32 [[A]], [[B]]
31; IS__TUNIT_NPM-NEXT:    store i32 [[AB]], i32* [[R]], align 4
32; IS__TUNIT_NPM-NEXT:    ret void
33;
34; IS__CGSCC_OPM: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn
35; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@add
36; IS__CGSCC_OPM-SAME: ({ i32, i32 }* nocapture nofree noundef nonnull readonly align 8 dereferenceable(8) [[THIS:%.*]], i32* nocapture nofree noundef nonnull writeonly sret(i32) align 4 dereferenceable(4) [[R:%.*]]) [[ATTR0:#.*]] {
37; IS__CGSCC_OPM-NEXT:    [[AP:%.*]] = getelementptr { i32, i32 }, { i32, i32 }* [[THIS]], i32 0, i32 0
38; IS__CGSCC_OPM-NEXT:    [[BP:%.*]] = getelementptr { i32, i32 }, { i32, i32 }* [[THIS]], i32 0, i32 1
39; IS__CGSCC_OPM-NEXT:    [[A:%.*]] = load i32, i32* [[AP]], align 8
40; IS__CGSCC_OPM-NEXT:    [[B:%.*]] = load i32, i32* [[BP]], align 4
41; IS__CGSCC_OPM-NEXT:    [[AB:%.*]] = add i32 [[A]], [[B]]
42; IS__CGSCC_OPM-NEXT:    store i32 [[AB]], i32* [[R]], align 4
43; IS__CGSCC_OPM-NEXT:    ret void
44;
45; IS__CGSCC_NPM: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn
46; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@add
47; IS__CGSCC_NPM-SAME: ({ i32, i32 }* noalias nocapture nofree noundef nonnull readonly align 8 dereferenceable(8) [[THIS:%.*]], i32* noalias nocapture nofree noundef nonnull writeonly sret(i32) align 4 dereferenceable(4) [[R:%.*]]) [[ATTR0:#.*]] {
48; IS__CGSCC_NPM-NEXT:    [[AP:%.*]] = getelementptr { i32, i32 }, { i32, i32 }* [[THIS]], i32 0, i32 0
49; IS__CGSCC_NPM-NEXT:    [[BP:%.*]] = getelementptr { i32, i32 }, { i32, i32 }* [[THIS]], i32 0, i32 1
50; IS__CGSCC_NPM-NEXT:    [[A:%.*]] = load i32, i32* [[AP]], align 8
51; IS__CGSCC_NPM-NEXT:    [[B:%.*]] = load i32, i32* [[BP]], align 4
52; IS__CGSCC_NPM-NEXT:    [[AB:%.*]] = add i32 [[A]], [[B]]
53; IS__CGSCC_NPM-NEXT:    store i32 [[AB]], i32* [[R]], align 4
54; IS__CGSCC_NPM-NEXT:    ret void
55;
56  %ap = getelementptr {i32, i32}, {i32, i32}* %this, i32 0, i32 0
57  %bp = getelementptr {i32, i32}, {i32, i32}* %this, i32 0, i32 1
58  %a = load i32, i32* %ap
59  %b = load i32, i32* %bp
60  %ab = add i32 %a, %b
61  store i32 %ab, i32* %r
62  ret void
63}
64
65define void @f() {
66; IS__TUNIT_OPM: Function Attrs: nofree nosync nounwind readnone willreturn
67; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@f
68; IS__TUNIT_OPM-SAME: () [[ATTR1:#.*]] {
69; IS__TUNIT_OPM-NEXT:    [[R:%.*]] = alloca i32, align 4
70; IS__TUNIT_OPM-NEXT:    [[PAIR:%.*]] = alloca { i32, i32 }, align 8
71; IS__TUNIT_OPM-NEXT:    call void @add({ i32, i32 }* nocapture nofree noundef nonnull readonly align 8 dereferenceable(8) [[PAIR]], i32* nocapture nofree noundef nonnull writeonly sret(i32) align 4 dereferenceable(4) [[R]]) [[ATTR2:#.*]]
72; IS__TUNIT_OPM-NEXT:    ret void
73;
74; IS__TUNIT_NPM: Function Attrs: nofree nosync nounwind readnone willreturn
75; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@f
76; IS__TUNIT_NPM-SAME: () [[ATTR1:#.*]] {
77; IS__TUNIT_NPM-NEXT:    [[R:%.*]] = alloca i32, align 4
78; IS__TUNIT_NPM-NEXT:    [[PAIR:%.*]] = alloca { i32, i32 }, align 8
79; IS__TUNIT_NPM-NEXT:    call void @add({ i32, i32 }* noalias nocapture nofree noundef nonnull readonly align 8 dereferenceable(8) [[PAIR]], i32* noalias nocapture nofree noundef nonnull writeonly sret(i32) align 4 dereferenceable(4) [[R]]) [[ATTR2:#.*]]
80; IS__TUNIT_NPM-NEXT:    ret void
81;
82; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
83; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@f
84; IS__CGSCC_OPM-SAME: () [[ATTR1:#.*]] {
85; IS__CGSCC_OPM-NEXT:    [[R:%.*]] = alloca i32, align 4
86; IS__CGSCC_OPM-NEXT:    [[PAIR:%.*]] = alloca { i32, i32 }, align 8
87; IS__CGSCC_OPM-NEXT:    call void @add({ i32, i32 }* nocapture nofree noundef nonnull readonly align 8 dereferenceable(8) [[PAIR]], i32* nocapture nofree noundef nonnull writeonly sret(i32) align 4 dereferenceable(4) [[R]]) [[ATTR2:#.*]]
88; IS__CGSCC_OPM-NEXT:    ret void
89;
90; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
91; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@f
92; IS__CGSCC_NPM-SAME: () [[ATTR1:#.*]] {
93; IS__CGSCC_NPM-NEXT:    [[R:%.*]] = alloca i32, align 4
94; IS__CGSCC_NPM-NEXT:    [[PAIR:%.*]] = alloca { i32, i32 }, align 8
95; IS__CGSCC_NPM-NEXT:    call void @add({ i32, i32 }* noalias nocapture nofree noundef nonnull readonly align 8 dereferenceable(8) [[PAIR]], i32* noalias nocapture nofree noundef nonnull writeonly sret(i32) align 4 dereferenceable(4) [[R]]) [[ATTR2:#.*]]
96; IS__CGSCC_NPM-NEXT:    ret void
97;
98  %r = alloca i32
99  %pair = alloca {i32, i32}
100
101  call void @add({i32, i32}* %pair, i32* sret(i32) %r)
102  ret void
103}
104