1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals
3 ; RUN: opt -S -passes=attributor --attributor-seed-allow-list asd < %s | FileCheck %s --check-prefixes=CHECK_DISABLED
4 ; RUN: opt -S -passes=attributor --attributor-seed-allow-list AAValueSimplify < %s | FileCheck %s --check-prefixes=CHECK_ENABLED
6 ; RUN: opt -S -passes=attributor --attributor-function-seed-allow-list asd < %s | FileCheck %s --check-prefixes=CHECK_DISABLED_FUNCTION
8 ; RUN: opt -S -passes=attributor --attributor-function-seed-allow-list range_use1 < %s | FileCheck %s --check-prefixes=CHECK_ENABLED_FUNCTION
13 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
15 ; Function Attrs: nounwind uwtable
16 define internal i32 @range_test(i32 %a) #0 {
17 ; CHECK_DISABLED: Function Attrs: noinline nounwind uwtable
18 ; CHECK_DISABLED-LABEL: define {{[^@]+}}@range_test
19 ; CHECK_DISABLED-SAME: (i32 [[A:%.*]]) #[[ATTR0:[0-9]+]] {
20 ; CHECK_DISABLED-NEXT: [[TMP1:%.*]] = icmp sgt i32 [[A]], 100
21 ; CHECK_DISABLED-NEXT: [[TMP2:%.*]] = zext i1 [[TMP1]] to i32
22 ; CHECK_DISABLED-NEXT: ret i32 [[TMP2]]
24 ; CHECK_DISABLED_FUNCTION: Function Attrs: noinline nounwind uwtable
25 ; CHECK_DISABLED_FUNCTION-LABEL: define {{[^@]+}}@range_test
26 ; CHECK_DISABLED_FUNCTION-SAME: (i32 [[A:%.*]]) #[[ATTR0:[0-9]+]] {
27 ; CHECK_DISABLED_FUNCTION-NEXT: [[TMP1:%.*]] = icmp sgt i32 [[A]], 100
28 ; CHECK_DISABLED_FUNCTION-NEXT: [[TMP2:%.*]] = zext i1 [[TMP1]] to i32
29 ; CHECK_DISABLED_FUNCTION-NEXT: ret i32 [[TMP2]]
31 ; CHECK_ENABLED_FUNCTION: Function Attrs: noinline nounwind readnone uwtable
32 ; CHECK_ENABLED_FUNCTION-LABEL: define {{[^@]+}}@range_test
33 ; CHECK_ENABLED_FUNCTION-SAME: () #[[ATTR0:[0-9]+]] {
34 ; CHECK_ENABLED_FUNCTION-NEXT: ret i32 1
36 %1 = icmp sgt i32 %a, 100
37 %2 = zext i1 %1 to i32
41 ; Function Attrs: nounwind uwtable
42 define i32 @range_use1() #0 {
43 ; CHECK_DISABLED: Function Attrs: noinline nounwind uwtable
44 ; CHECK_DISABLED-LABEL: define {{[^@]+}}@range_use1
45 ; CHECK_DISABLED-SAME: () #[[ATTR0]] {
46 ; CHECK_DISABLED-NEXT: [[TMP1:%.*]] = call i32 @range_test(i32 123)
47 ; CHECK_DISABLED-NEXT: ret i32 [[TMP1]]
49 ; CHECK_ENABLED: Function Attrs: noinline nounwind uwtable
50 ; CHECK_ENABLED-LABEL: define {{[^@]+}}@range_use1
51 ; CHECK_ENABLED-SAME: () #[[ATTR0:[0-9]+]] {
52 ; CHECK_ENABLED-NEXT: ret i32 1
54 ; CHECK_DISABLED_FUNCTION: Function Attrs: noinline nounwind uwtable
55 ; CHECK_DISABLED_FUNCTION-LABEL: define {{[^@]+}}@range_use1
56 ; CHECK_DISABLED_FUNCTION-SAME: () #[[ATTR0]] {
57 ; CHECK_DISABLED_FUNCTION-NEXT: [[TMP1:%.*]] = call i32 @range_test(i32 123)
58 ; CHECK_DISABLED_FUNCTION-NEXT: ret i32 [[TMP1]]
60 ; CHECK_ENABLED_FUNCTION: Function Attrs: nofree noinline nosync nounwind readnone uwtable willreturn
61 ; CHECK_ENABLED_FUNCTION-LABEL: define {{[^@]+}}@range_use1
62 ; CHECK_ENABLED_FUNCTION-SAME: () #[[ATTR1:[0-9]+]] {
63 ; CHECK_ENABLED_FUNCTION-NEXT: ret i32 1
65 %1 = call i32 @range_test(i32 123)
69 ; Function Attrs: nounwind uwtable
70 define i32 @range_use2() #0 {
71 ; CHECK_DISABLED: Function Attrs: noinline nounwind uwtable
72 ; CHECK_DISABLED-LABEL: define {{[^@]+}}@range_use2
73 ; CHECK_DISABLED-SAME: () #[[ATTR0]] {
74 ; CHECK_DISABLED-NEXT: [[TMP1:%.*]] = call i32 @range_test(i32 123)
75 ; CHECK_DISABLED-NEXT: ret i32 [[TMP1]]
77 ; CHECK_ENABLED: Function Attrs: noinline nounwind uwtable
78 ; CHECK_ENABLED-LABEL: define {{[^@]+}}@range_use2
79 ; CHECK_ENABLED-SAME: () #[[ATTR0]] {
80 ; CHECK_ENABLED-NEXT: ret i32 1
82 ; CHECK_DISABLED_FUNCTION: Function Attrs: noinline nounwind uwtable
83 ; CHECK_DISABLED_FUNCTION-LABEL: define {{[^@]+}}@range_use2
84 ; CHECK_DISABLED_FUNCTION-SAME: () #[[ATTR0]] {
85 ; CHECK_DISABLED_FUNCTION-NEXT: [[TMP1:%.*]] = call i32 @range_test(i32 123)
86 ; CHECK_DISABLED_FUNCTION-NEXT: ret i32 [[TMP1]]
88 ; CHECK_ENABLED_FUNCTION: Function Attrs: noinline nounwind uwtable
89 ; CHECK_ENABLED_FUNCTION-LABEL: define {{[^@]+}}@range_use2
90 ; CHECK_ENABLED_FUNCTION-SAME: () #[[ATTR2:[0-9]+]] {
91 ; CHECK_ENABLED_FUNCTION-NEXT: [[TMP1:%.*]] = call i32 @range_test()
92 ; CHECK_ENABLED_FUNCTION-NEXT: ret i32 [[TMP1]]
94 %1 = call i32 @range_test(i32 123)
98 attributes #0 = { nounwind uwtable noinline }
100 ; CHECK_DISABLED: attributes #[[ATTR0]] = { noinline nounwind uwtable }
102 ; CHECK_ENABLED: attributes #[[ATTR0]] = { noinline nounwind uwtable }
104 ; CHECK_DISABLED_FUNCTION: attributes #[[ATTR0]] = { noinline nounwind uwtable }
106 ; CHECK_ENABLED_FUNCTION: attributes #[[ATTR0]] = { noinline nounwind readnone uwtable }
107 ; CHECK_ENABLED_FUNCTION: attributes #[[ATTR1]] = { nofree noinline nosync nounwind readnone uwtable willreturn }
108 ; CHECK_ENABLED_FUNCTION: attributes #[[ATTR2]] = { noinline nounwind uwtable }