1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
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 declare float @llvm.arithmetic.fence.f32(float)
6 declare float @extern(float)
8 ; arg missing nofpclass
9 define nofpclass(nan) float @return_implies_arg(float %arg) {
10 ; CHECK-LABEL: define nofpclass(nan) float @return_implies_arg
11 ; CHECK-SAME: (float returned [[ARG:%.*]]) #[[ATTR1:[0-9]+]] {
12 ; CHECK-NEXT: ret float [[ARG]]
17 ; return should get marked nofpclass(inf nan)
18 define internal float @callsite_implies_return() {
19 ; CHECK-LABEL: define internal float @callsite_implies_return() {
20 ; CHECK-NEXT: [[VALUE:%.*]] = call float @extern(float noundef nofpclass(nan inf zero sub nnorm) 1.000000e+00)
21 ; CHECK-NEXT: ret float [[VALUE]]
23 %value = call float @extern(float 1.0)
27 ; arg should get nofpclass(inf nan)
28 define float @nofpclass_callsite_arg_implies_arg(float %arg) {
29 ; CHECK-LABEL: define float @nofpclass_callsite_arg_implies_arg
30 ; CHECK-SAME: (float nofpclass(nan inf) [[ARG:%.*]]) {
31 ; CHECK-NEXT: [[CALL:%.*]] = call float @extern(float nofpclass(nan inf) [[ARG]])
32 ; CHECK-NEXT: ret float [[CALL]]
34 %call = call float @extern(float nofpclass(inf nan) %arg)
38 define float @nofpclass_earlier_call_implies_later_call_arg(float %arg) {
39 ; CHECK-LABEL: define float @nofpclass_earlier_call_implies_later_call_arg
40 ; CHECK-SAME: (float nofpclass(nan inf) [[ARG:%.*]]) {
41 ; CHECK-NEXT: [[CALL0:%.*]] = call float @extern(float nofpclass(nan inf) [[ARG]])
42 ; CHECK-NEXT: [[CALL1:%.*]] = call float @extern(float nofpclass(nan inf) [[ARG]])
43 ; CHECK-NEXT: [[ADD:%.*]] = fadd float [[CALL0]], [[CALL1]]
44 ; CHECK-NEXT: ret float [[ADD]]
46 %call0 = call float @extern(float nofpclass(inf nan) %arg)
47 %call1 = call float @extern(float %arg) ; nofpclass should be implied here
48 %add = fadd float %call0, %call1
52 define float @nnan_ninf_implies_arg_return(float %arg) {
53 ; CHECK-LABEL: define nofpclass(nan inf) float @nnan_ninf_implies_arg_return
54 ; CHECK-SAME: (float [[ARG:%.*]]) {
55 ; CHECK-NEXT: [[CALL:%.*]] = call nnan ninf nofpclass(nan inf) float @extern(float [[ARG]])
56 ; CHECK-NEXT: ret float [[CALL]]
58 %call = call nnan ninf float @extern(float %arg)
62 define float @callsite_returns_nofpclass_nan() {
63 ; CHECK-LABEL: define nofpclass(nan inf) float @callsite_returns_nofpclass_nan() {
64 ; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(nan inf) float @callsite_implies_return()
65 ; CHECK-NEXT: ret float [[CALL]]
67 %call = call nofpclass(inf nan) float @callsite_implies_return()
72 define float @nnan_implies_arg_return(float %arg) {
73 ; CHECK-LABEL: define nofpclass(nan) float @nnan_implies_arg_return
74 ; CHECK-SAME: (float [[ARG:%.*]]) {
75 ; CHECK-NEXT: [[CALL:%.*]] = call nnan nofpclass(nan) float @extern(float [[ARG]])
76 ; CHECK-NEXT: ret float [[CALL]]
78 %call = call nnan float @extern(float %arg)
82 define float @ninf_implies_arg_return(float %arg) {
83 ; CHECK-LABEL: define nofpclass(inf) float @ninf_implies_arg_return
84 ; CHECK-SAME: (float [[ARG:%.*]]) {
85 ; CHECK-NEXT: [[CALL:%.*]] = call ninf nofpclass(inf) float @extern(float [[ARG]])
86 ; CHECK-NEXT: ret float [[CALL]]
88 %call = call ninf float @extern(float %arg)
92 ;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: