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-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
7 %0 = type { i32, %1, ptr }
11 define hidden ptr @f1(i64 %0, i64 %1) {
12 ; CHECK-LABEL: define {{[^@]+}}@f1
13 ; CHECK-SAME: (i64 [[TMP0:%.*]], i64 [[TMP1:%.*]]) {
14 ; CHECK-NEXT: [[TMP3:%.*]] = call { ptr, i64 } @f3(i64 [[TMP0]])
15 ; CHECK-NEXT: ret ptr undef
17 %3 = call { ptr, i64 } @f3(i64 %0)
21 define linkonce_odr hidden { ptr, i64 } @f3(i64 %0) align 2 {
22 ; CHECK-LABEL: define {{[^@]+}}@f3
23 ; CHECK-SAME: (i64 [[TMP0:%.*]]) align 2 {
24 ; CHECK-NEXT: [[TMP2:%.*]] = call i32 @f4()
25 ; CHECK-NEXT: [[TMP3:%.*]] = zext i32 [[TMP2]] to i64
26 ; CHECK-NEXT: call void @f5(i64 [[TMP3]], i64 [[TMP0]]) #[[ATTR2:[0-9]+]]
27 ; CHECK-NEXT: ret { ptr, i64 } undef
30 %3 = zext i32 %2 to i64
31 call void @f5(i64 %3, i64 %0)
32 ret { ptr, i64 } undef
35 define linkonce_odr hidden i32 @f4() align 2 {
36 ; CHECK-LABEL: define {{[^@]+}}@f4() align 2 {
37 ; CHECK-NEXT: ret i32 16
42 define internal void @f5(i64 %0, i64 %1) {
43 ; CHECK: Function Attrs: nounwind memory(inaccessiblemem: write)
44 ; CHECK-LABEL: define {{[^@]+}}@f5
45 ; CHECK-SAME: (i64 [[TMP0:%.*]], i64 [[TMP1:%.*]]) #[[ATTR0:[0-9]+]] {
46 ; CHECK-NEXT: br label [[TMP3:%.*]]
48 ; CHECK-NEXT: call void @f6(i64 [[TMP0]]) #[[ATTR2]]
49 ; CHECK-NEXT: [[TMP4:%.*]] = icmp sgt i64 [[TMP1]], [[TMP0]]
50 ; CHECK-NEXT: br i1 [[TMP4]], label [[TMP5:%.*]], label [[TMP6:%.*]]
52 ; CHECK-NEXT: ret void
54 ; CHECK-NEXT: call void @f5(i64 [[TMP0]], i64 [[TMP1]]) #[[ATTR2]]
55 ; CHECK-NEXT: br label [[TMP3]]
61 %4 = icmp sgt i64 %1, %0
62 br i1 %4, label %5, label %6
68 call void @f5(i64 %0, i64 %1)
72 define internal void @f6(i64 %0) {
73 ; CHECK: Function Attrs: nounwind memory(inaccessiblemem: write)
74 ; CHECK-LABEL: define {{[^@]+}}@f6
75 ; CHECK-SAME: (i64 [[TMP0:%.*]]) #[[ATTR0]] {
76 ; CHECK-NEXT: [[TMP2:%.*]] = icmp sgt i64 [[TMP0]], 0
77 ; CHECK-NEXT: br i1 [[TMP2]], label [[TMP3:%.*]], label [[TMP4:%.*]]
79 ; CHECK-NEXT: call void @llvm.trap() #[[ATTR3:[0-9]+]]
80 ; CHECK-NEXT: unreachable
82 ; CHECK-NEXT: ret void
84 %2 = icmp sgt i64 %0, 0
85 br i1 %2, label %3, label %4
88 call void @llvm.trap()
95 ; Function Attrs: cold noreturn nounwind
96 declare void @llvm.trap() #0
98 attributes #0 = { cold noreturn nounwind }
101 ; CHECK: attributes #[[ATTR0]] = { nounwind memory(inaccessiblemem: write) }
102 ; CHECK: attributes #[[ATTR1:[0-9]+]] = { cold noreturn nounwind memory(inaccessiblemem: write) }
103 ; CHECK: attributes #[[ATTR2]] = { nounwind memory(write) }
104 ; CHECK: attributes #[[ATTR3]] = { noreturn memory(write) }
106 ;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: