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_ENABLED: Function Attrs: noinline nounwind uwtable
25 ; CHECK_ENABLED-LABEL: define {{[^@]+}}@range_test
26 ; CHECK_ENABLED-SAME: (i32 [[A:%.*]]) #[[ATTR0:[0-9]+]] {
27 ; CHECK_ENABLED-NEXT: [[TMP1:%.*]] = icmp sgt i32 [[A]], 100
28 ; CHECK_ENABLED-NEXT: [[TMP2:%.*]] = zext i1 [[TMP1]] to i32
29 ; CHECK_ENABLED-NEXT: ret i32 [[TMP2]]
31 ; CHECK_DISABLED_FUNCTION: Function Attrs: noinline nounwind uwtable
32 ; CHECK_DISABLED_FUNCTION-LABEL: define {{[^@]+}}@range_test
33 ; CHECK_DISABLED_FUNCTION-SAME: (i32 [[A:%.*]]) #[[ATTR0:[0-9]+]] {
34 ; CHECK_DISABLED_FUNCTION-NEXT: [[TMP1:%.*]] = icmp sgt i32 [[A]], 100
35 ; CHECK_DISABLED_FUNCTION-NEXT: [[TMP2:%.*]] = zext i1 [[TMP1]] to i32
36 ; CHECK_DISABLED_FUNCTION-NEXT: ret i32 [[TMP2]]
38 ; CHECK_ENABLED_FUNCTION: Function Attrs: noinline nounwind uwtable
39 ; CHECK_ENABLED_FUNCTION-LABEL: define {{[^@]+}}@range_test
40 ; CHECK_ENABLED_FUNCTION-SAME: (i32 [[A:%.*]]) #[[ATTR0:[0-9]+]] {
41 ; CHECK_ENABLED_FUNCTION-NEXT: [[TMP1:%.*]] = icmp sgt i32 [[A]], 100
42 ; CHECK_ENABLED_FUNCTION-NEXT: [[TMP2:%.*]] = zext i1 [[TMP1]] to i32
43 ; CHECK_ENABLED_FUNCTION-NEXT: ret i32 [[TMP2]]
45 %1 = icmp sgt i32 %a, 100
46 %2 = zext i1 %1 to i32
50 ; Function Attrs: nounwind uwtable
51 define i32 @range_use1() #0 {
52 ; CHECK_DISABLED: Function Attrs: noinline nounwind uwtable
53 ; CHECK_DISABLED-LABEL: define {{[^@]+}}@range_use1
54 ; CHECK_DISABLED-SAME: () #[[ATTR0]] {
55 ; CHECK_DISABLED-NEXT: [[TMP1:%.*]] = call i32 @range_test(i32 noundef 123)
56 ; CHECK_DISABLED-NEXT: ret i32 [[TMP1]]
58 ; CHECK_ENABLED: Function Attrs: noinline nounwind uwtable
59 ; CHECK_ENABLED-LABEL: define {{[^@]+}}@range_use1
60 ; CHECK_ENABLED-SAME: () #[[ATTR0]] {
61 ; CHECK_ENABLED-NEXT: [[TMP1:%.*]] = call i32 @range_test(i32 noundef 123)
62 ; CHECK_ENABLED-NEXT: ret i32 [[TMP1]]
64 ; CHECK_DISABLED_FUNCTION: Function Attrs: noinline nounwind uwtable
65 ; CHECK_DISABLED_FUNCTION-LABEL: define {{[^@]+}}@range_use1
66 ; CHECK_DISABLED_FUNCTION-SAME: () #[[ATTR0]] {
67 ; CHECK_DISABLED_FUNCTION-NEXT: [[TMP1:%.*]] = call i32 @range_test(i32 noundef 123)
68 ; CHECK_DISABLED_FUNCTION-NEXT: ret i32 [[TMP1]]
70 ; CHECK_ENABLED_FUNCTION: Function Attrs: noinline norecurse nounwind uwtable
71 ; CHECK_ENABLED_FUNCTION-LABEL: define {{[^@]+}}@range_use1
72 ; CHECK_ENABLED_FUNCTION-SAME: () #[[ATTR1:[0-9]+]] {
73 ; CHECK_ENABLED_FUNCTION-NEXT: [[TMP1:%.*]] = call i32 @range_test(i32 noundef 123) #[[ATTR2:[0-9]+]]
74 ; CHECK_ENABLED_FUNCTION-NEXT: ret i32 [[TMP1]]
76 %1 = call i32 @range_test(i32 123)
80 ; Function Attrs: nounwind uwtable
81 define i32 @range_use2() #0 {
82 ; CHECK_DISABLED: Function Attrs: noinline nounwind uwtable
83 ; CHECK_DISABLED-LABEL: define {{[^@]+}}@range_use2
84 ; CHECK_DISABLED-SAME: () #[[ATTR0]] {
85 ; CHECK_DISABLED-NEXT: [[TMP1:%.*]] = call i32 @range_test(i32 noundef 123)
86 ; CHECK_DISABLED-NEXT: ret i32 [[TMP1]]
88 ; CHECK_ENABLED: Function Attrs: noinline nounwind uwtable
89 ; CHECK_ENABLED-LABEL: define {{[^@]+}}@range_use2
90 ; CHECK_ENABLED-SAME: () #[[ATTR0]] {
91 ; CHECK_ENABLED-NEXT: [[TMP1:%.*]] = call i32 @range_test(i32 noundef 123)
92 ; CHECK_ENABLED-NEXT: ret i32 [[TMP1]]
94 ; CHECK_DISABLED_FUNCTION: Function Attrs: noinline nounwind uwtable
95 ; CHECK_DISABLED_FUNCTION-LABEL: define {{[^@]+}}@range_use2
96 ; CHECK_DISABLED_FUNCTION-SAME: () #[[ATTR0]] {
97 ; CHECK_DISABLED_FUNCTION-NEXT: [[TMP1:%.*]] = call i32 @range_test(i32 noundef 123)
98 ; CHECK_DISABLED_FUNCTION-NEXT: ret i32 [[TMP1]]
100 ; CHECK_ENABLED_FUNCTION: Function Attrs: noinline nounwind uwtable
101 ; CHECK_ENABLED_FUNCTION-LABEL: define {{[^@]+}}@range_use2
102 ; CHECK_ENABLED_FUNCTION-SAME: () #[[ATTR0]] {
103 ; CHECK_ENABLED_FUNCTION-NEXT: [[TMP1:%.*]] = call i32 @range_test(i32 noundef 123)
104 ; CHECK_ENABLED_FUNCTION-NEXT: ret i32 [[TMP1]]
106 %1 = call i32 @range_test(i32 123)
110 attributes #0 = { nounwind uwtable noinline }
112 ; CHECK_DISABLED: attributes #[[ATTR0]] = { noinline nounwind uwtable }
114 ; CHECK_ENABLED: attributes #[[ATTR0]] = { noinline nounwind uwtable }
116 ; CHECK_DISABLED_FUNCTION: attributes #[[ATTR0]] = { noinline nounwind uwtable }
118 ; CHECK_ENABLED_FUNCTION: attributes #[[ATTR0]] = { noinline nounwind uwtable }
119 ; CHECK_ENABLED_FUNCTION: attributes #[[ATTR1]] = { noinline norecurse nounwind uwtable }
120 ; CHECK_ENABLED_FUNCTION: attributes #[[ATTR2]] = { nounwind }