1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals
2 ; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,TUNIT
3 ; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,CGSCC
5 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
6 target triple = "x86_64-unknown-linux-gnu"
10 ; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
11 ; TUNIT-LABEL: define {{[^@]+}}@fn2
12 ; TUNIT-SAME: () #[[ATTR0:[0-9]+]] {
14 ; TUNIT-NEXT: ret i64 undef
16 ; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
17 ; CGSCC-LABEL: define {{[^@]+}}@fn2
18 ; CGSCC-SAME: () #[[ATTR0:[0-9]+]] {
20 ; CGSCC-NEXT: [[CONV:%.*]] = sext i32 undef to i64
21 ; CGSCC-NEXT: [[DIV:%.*]] = sdiv i64 8, [[CONV]]
22 ; CGSCC-NEXT: [[CALL2:%.*]] = call i64 @fn1(i64 [[DIV]]) #[[ATTR2:[0-9]+]]
23 ; CGSCC-NEXT: ret i64 [[CALL2]]
26 %conv = sext i32 undef to i64
27 %div = sdiv i64 8, %conv
28 %call2 = call i64 @fn1(i64 %div)
32 define i64 @fn2b(i32 %arg) {
34 ; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
35 ; TUNIT-LABEL: define {{[^@]+}}@fn2b
36 ; TUNIT-SAME: (i32 [[ARG:%.*]]) #[[ATTR0]] {
38 ; TUNIT-NEXT: [[CONV:%.*]] = sext i32 [[ARG]] to i64
39 ; TUNIT-NEXT: [[DIV:%.*]] = sdiv i64 8, [[CONV]]
40 ; TUNIT-NEXT: ret i64 [[DIV]]
42 ; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
43 ; CGSCC-LABEL: define {{[^@]+}}@fn2b
44 ; CGSCC-SAME: (i32 [[ARG:%.*]]) #[[ATTR0]] {
46 ; CGSCC-NEXT: [[CONV:%.*]] = sext i32 [[ARG]] to i64
47 ; CGSCC-NEXT: [[DIV:%.*]] = sdiv i64 8, [[CONV]]
48 ; CGSCC-NEXT: [[CALL2:%.*]] = call i64 @fn1(i64 [[DIV]]) #[[ATTR2]]
49 ; CGSCC-NEXT: ret i64 [[CALL2]]
52 %conv = sext i32 %arg to i64
53 %div = sdiv i64 8, %conv
54 %call2 = call i64 @fn1(i64 %div)
59 ; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
60 ; TUNIT-LABEL: define {{[^@]+}}@fn2c
61 ; TUNIT-SAME: () #[[ATTR0]] {
63 ; TUNIT-NEXT: ret i64 42
65 ; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
66 ; CGSCC-LABEL: define {{[^@]+}}@fn2c
67 ; CGSCC-SAME: () #[[ATTR0]] {
69 ; CGSCC-NEXT: [[CONV:%.*]] = sext i32 undef to i64
70 ; CGSCC-NEXT: [[ADD:%.*]] = add i64 42, [[CONV]]
71 ; CGSCC-NEXT: [[CALL2:%.*]] = call i64 @fn1(i64 [[ADD]]) #[[ATTR2]], !range [[RNG0:![0-9]+]]
72 ; CGSCC-NEXT: ret i64 [[CALL2]]
75 %conv = sext i32 undef to i64
76 %add = add i64 42, %conv
77 %call2 = call i64 @fn1(i64 %add)
81 define internal i64 @fn1(i64 %p1) {
82 ; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
83 ; CGSCC-LABEL: define {{[^@]+}}@fn1
84 ; CGSCC-SAME: (i64 returned [[P1:%.*]]) #[[ATTR1:[0-9]+]] {
86 ; CGSCC-NEXT: ret i64 [[P1]]
89 %tobool = icmp ne i64 %p1, 0
90 %cond = select i1 %tobool, i64 %p1, i64 %p1
94 ; CGSCC: attributes #[[ATTR0]] = { mustprogress nofree nosync nounwind willreturn memory(none) }
95 ; CGSCC: attributes #[[ATTR1]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
96 ; CGSCC: attributes #[[ATTR2]] = { nofree nosync willreturn }
98 ; TUNIT: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
100 ; CGSCC: [[RNG0]] = !{i64 -2147483606, i64 2147483690}
102 ;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: