1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function caller --check-globals all --version 4
2 ; RUN: opt --passes=globalopt -o - -S < %s | FileCheck %s --implicit-check-not=trivial\.ifunc --implicit-check-not=dead_ifunc
4 target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
5 target triple = "aarch64-unknown-linux-gnu"
7 @trivial.ifunc = internal ifunc void (), ptr @trivial.resolver
9 ; CHECK: @unknown_condition = external local_unnamed_addr global i1
10 ; CHECK: @alias_decl = weak_odr alias void (), ptr @aliased_decl.ifunc
11 ; CHECK: @alias_def = weak_odr alias void (), ptr @aliased_def._Msimd
12 ; CHECK: @external_ifunc.ifunc = dso_local ifunc void (), ptr @external_ifunc.resolver
13 ; CHECK: @complex.ifunc = internal ifunc void (), ptr @complex.resolver
14 ; CHECK: @sideeffects.ifunc = internal ifunc void (), ptr @sideeffects.resolver
15 ; CHECK: @interposable_ifunc.ifunc = internal ifunc void (), ptr @interposable_ifunc.resolver
16 ; CHECK: @interposable_resolver.ifunc = weak ifunc void (), ptr @interposable_resolver.resolver
17 ; CHECK: @aliased_decl.ifunc = weak_odr ifunc void (), ptr @aliased_decl.resolver
18 ; CHECK: @aliased_def.ifunc = weak_odr ifunc void (), ptr @aliased_def.resolver
20 define ptr @trivial.resolver() {
21 ret ptr @trivial._Msimd
23 define void @trivial._Msimd() {
26 define void @trivial.default() {
31 @dead_ifunc.ifunc = internal ifunc void (), ptr @trivial.resolver
33 @external_ifunc.ifunc = dso_local ifunc void (), ptr @external_ifunc.resolver
34 define ptr @external_ifunc.resolver() {
35 ret ptr @external_ifunc._Msimd
37 define void @external_ifunc._Msimd() {
40 define void @external_ifunc.default() {
44 @unknown_condition = external global i1
45 @complex.ifunc = internal ifunc void (), ptr @complex.resolver
46 define ptr @complex.resolver() {
48 %v = load i1, ptr @unknown_condition
49 br i1 %v, label %fast, label %slow
51 ret ptr @complex._Msimd
53 ret ptr @complex._Msimd
55 define void @complex._Msimd() {
58 define void @complex.default() {
62 @sideeffects.ifunc = internal ifunc void (), ptr @sideeffects.resolver
63 define ptr @sideeffects.resolver() {
64 store i1 0, ptr @unknown_condition
65 ret ptr @sideeffects.default
67 define void @sideeffects._Msimd() {
70 define void @sideeffects.default() {
74 @interposable_ifunc.ifunc = internal ifunc void (), ptr @interposable_ifunc.resolver
75 define weak ptr @interposable_ifunc.resolver() {
76 ret ptr @interposable_ifunc.resolver
78 define void @interposable_ifunc._Msimd() {
81 define void @interposable_ifunc.default() {
85 @interposable_resolver.ifunc = weak ifunc void (), ptr @interposable_resolver.resolver
86 define ptr @interposable_resolver.resolver() {
87 ret ptr @interposable_resolver.resolver
89 define void @interposable_resolver._Msimd() {
92 define void @interposable_resolver.default() {
96 @alias_decl = weak_odr alias void (), ptr @aliased_decl.ifunc
97 @aliased_decl.ifunc = weak_odr ifunc void (), ptr @aliased_decl.resolver
98 declare void @aliased_decl._Msimd()
99 define ptr @aliased_decl.resolver() {
100 ret ptr @aliased_decl._Msimd
103 @alias_def = weak_odr alias void (), ptr @aliased_def.ifunc
104 @aliased_def.ifunc = weak_odr ifunc void (), ptr @aliased_def.resolver
105 define void @aliased_def._Msimd() { ret void }
106 define ptr @aliased_def.resolver() {
107 ret ptr @aliased_def._Msimd
110 define void @caller() {
111 ; CHECK-LABEL: define void @caller() local_unnamed_addr {
112 ; CHECK-NEXT: call void @trivial._Msimd()
113 ; CHECK-NEXT: call void @external_ifunc._Msimd()
114 ; CHECK-NEXT: call void @complex.ifunc()
115 ; CHECK-NEXT: call void @sideeffects.ifunc()
116 ; CHECK-NEXT: call void @interposable_ifunc.ifunc()
117 ; CHECK-NEXT: call void @interposable_resolver.ifunc()
118 ; CHECK-NEXT: call void @aliased_decl.ifunc()
119 ; CHECK-NEXT: call void @aliased_def._Msimd()
120 ; CHECK-NEXT: ret void
122 call void @trivial.ifunc()
123 call void @external_ifunc.ifunc()
124 call void @complex.ifunc()
125 call void @sideeffects.ifunc()
126 call void @interposable_ifunc.ifunc()
127 call void @interposable_resolver.ifunc()
128 call void @aliased_decl.ifunc()
129 call void @aliased_def.ifunc()