• 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=1 -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=1 -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
7%T = type { i32, i32, i32, i32 }
8@G = constant %T { i32 0, i32 0, i32 17, i32 25 }
9
10define internal i32 @test(%T* %p) {
11; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
12; IS__TUNIT____-LABEL: define {{[^@]+}}@test
13; IS__TUNIT____-SAME: () [[ATTR0:#.*]] {
14; IS__TUNIT____-NEXT:  entry:
15; IS__TUNIT____-NEXT:    [[A_GEP:%.*]] = getelementptr [[T:%.*]], %T* @G, i64 0, i32 3
16; IS__TUNIT____-NEXT:    [[B_GEP:%.*]] = getelementptr [[T]], %T* @G, i64 0, i32 2
17; IS__TUNIT____-NEXT:    [[A:%.*]] = load i32, i32* [[A_GEP]], align 4
18; IS__TUNIT____-NEXT:    [[B:%.*]] = load i32, i32* [[B_GEP]], align 4
19; IS__TUNIT____-NEXT:    [[V:%.*]] = add i32 [[A]], [[B]]
20; IS__TUNIT____-NEXT:    ret i32 [[V]]
21;
22; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
23; IS__CGSCC____-LABEL: define {{[^@]+}}@test
24; IS__CGSCC____-SAME: () [[ATTR0:#.*]] {
25; IS__CGSCC____-NEXT:  entry:
26; IS__CGSCC____-NEXT:    [[A_GEP:%.*]] = getelementptr [[T:%.*]], %T* @G, i64 0, i32 3
27; IS__CGSCC____-NEXT:    [[B_GEP:%.*]] = getelementptr [[T]], %T* @G, i64 0, i32 2
28; IS__CGSCC____-NEXT:    [[A:%.*]] = load i32, i32* [[A_GEP]], align 4
29; IS__CGSCC____-NEXT:    [[B:%.*]] = load i32, i32* [[B_GEP]], align 8
30; IS__CGSCC____-NEXT:    [[V:%.*]] = add i32 [[A]], [[B]]
31; IS__CGSCC____-NEXT:    ret i32 [[V]]
32;
33entry:
34  %a.gep = getelementptr %T, %T* %p, i64 0, i32 3
35  %b.gep = getelementptr %T, %T* %p, i64 0, i32 2
36  %a = load i32, i32* %a.gep
37  %b = load i32, i32* %b.gep
38  %v = add i32 %a, %b
39  ret i32 %v
40}
41
42define i32 @caller() {
43; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
44; IS__TUNIT____-LABEL: define {{[^@]+}}@caller
45; IS__TUNIT____-SAME: () [[ATTR0]] {
46; IS__TUNIT____-NEXT:  entry:
47; IS__TUNIT____-NEXT:    [[V:%.*]] = call i32 @test() [[ATTR0]]
48; IS__TUNIT____-NEXT:    ret i32 [[V]]
49;
50; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
51; IS__CGSCC____-LABEL: define {{[^@]+}}@caller
52; IS__CGSCC____-SAME: () [[ATTR0]] {
53; IS__CGSCC____-NEXT:  entry:
54; IS__CGSCC____-NEXT:    [[V:%.*]] = call i32 @test() [[ATTR1:#.*]]
55; IS__CGSCC____-NEXT:    ret i32 [[V]]
56;
57entry:
58  %v = call i32 @test(%T* @G)
59  ret i32 %v
60}
61