1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
2 ; RUN: opt -passes=attributor -S < %s | FileCheck %s
4 ; Global variables that reference themselves alongside a function that is called indirectly
5 ; used to cause an infinite loop in the attributor. The recursive reference was continually
6 ; pushed back into the workload, causing the attributor to hang indefinitely.
8 @glob1 = global { ptr, ptr } { ptr @glob1, ptr @fnc1 }
9 @glob2 = global { ptr, ptr } { ptr @glob3, ptr @fnc2 }
10 @glob3 = global { ptr, ptr } { ptr @glob2, ptr @fnc2 }
12 define internal void @fnc1() {
13 ; CHECK-LABEL: define internal void @fnc1(
14 ; CHECK-SAME: ) #[[ATTR0:[0-9]+]] {
15 ; CHECK-NEXT: ret void
20 define internal void @fnc2() {
21 ; CHECK-LABEL: define internal void @fnc2(
22 ; CHECK-SAME: ) #[[ATTR0]] {
23 ; CHECK-NEXT: ret void
28 define dso_local void @indr_caller(ptr %0) {
29 ; CHECK-LABEL: define dso_local void @indr_caller(
30 ; CHECK-SAME: ptr nocapture nofree noundef nonnull [[TMP0:%.*]]) {
31 ; CHECK-NEXT: call void [[TMP0]]()
32 ; CHECK-NEXT: ret void
39 ; CHECK-LABEL: define void @main() {
40 ; CHECK-NEXT: call void @indr_caller(ptr nocapture nofree noundef nonnull @fnc1)
41 ; CHECK-NEXT: call void @indr_caller(ptr nocapture nofree noundef nonnull @fnc2)
42 ; CHECK-NEXT: ret void
44 call void @indr_caller(ptr @fnc1)
45 call void @indr_caller(ptr @fnc2)