|
| 1 | +; RUN: opt --passes=globalopt -o - -S < %s | FileCheck %s |
| 2 | + |
| 3 | +target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128" |
| 4 | +target triple = "aarch64-unknown-linux-gnu" |
| 5 | + |
| 6 | +$callee_with_trivial_resolver.resolver = comdat any |
| 7 | +@callee_with_trivial_resolver.ifunc = weak_odr dso_local ifunc void (), ptr @callee_with_trivial_resolver.resolver |
| 8 | +define weak_odr ptr @callee_with_trivial_resolver.resolver() comdat { |
| 9 | + ret ptr @callee_with_trivial_resolver._Msimd |
| 10 | +} |
| 11 | +define void @callee_with_trivial_resolver._Msimd() { |
| 12 | + ret void |
| 13 | +} |
| 14 | +define void @callee_with_trivial_resolver.default() { |
| 15 | + ret void |
| 16 | +} |
| 17 | + |
| 18 | +@unknown_condition = external global i1 |
| 19 | +$callee_with_complex_static_resolver.resolver = comdat any |
| 20 | +@callee_with_complex_static_resolver.ifunc = weak_odr dso_local ifunc void (), ptr @callee_with_complex_static_resolver.resolver |
| 21 | +define weak_odr ptr @callee_with_complex_static_resolver.resolver() comdat { |
| 22 | +entry: |
| 23 | + %v = load i1, ptr @unknown_condition |
| 24 | + br i1 %v, label %fast, label %slow |
| 25 | +fast: |
| 26 | + ret ptr @callee_with_complex_static_resolver._Msimd |
| 27 | +slow: |
| 28 | + ret ptr @callee_with_complex_static_resolver._Msimd |
| 29 | +} |
| 30 | +define void @callee_with_complex_static_resolver._Msimd() { |
| 31 | + ret void |
| 32 | +} |
| 33 | +define void @callee_with_complex_static_resolver.default() { |
| 34 | + ret void |
| 35 | +} |
| 36 | + |
| 37 | +$callee_with_complex_dynamic_resolver.resolver = comdat any |
| 38 | +@callee_with_complex_dynamic_resolver.ifunc = weak_odr dso_local ifunc void (), ptr @callee_with_complex_dynamic_resolver.resolver |
| 39 | +define weak_odr ptr @callee_with_complex_dynamic_resolver.resolver() comdat { |
| 40 | +entry: |
| 41 | + %v = load i1, ptr @unknown_condition |
| 42 | + br i1 %v, label %fast, label %slow |
| 43 | +fast: |
| 44 | + ret ptr @callee_with_complex_dynamic_resolver._Msimd |
| 45 | +slow: |
| 46 | + ret ptr @callee_with_complex_dynamic_resolver.default |
| 47 | +} |
| 48 | +define void @callee_with_complex_dynamic_resolver._Msimd() { |
| 49 | + ret void |
| 50 | +} |
| 51 | +define void @callee_with_complex_dynamic_resolver.default() { |
| 52 | + ret void |
| 53 | +} |
| 54 | + |
| 55 | +$callee_with_sideeffects_resolver.resolver = comdat any |
| 56 | +@callee_with_sideeffects_resolver.ifunc = weak_odr dso_local ifunc void (), ptr @callee_with_sideeffects_resolver.resolver |
| 57 | +define weak_odr ptr @callee_with_sideeffects_resolver.resolver() comdat { |
| 58 | + store i1 0, ptr @unknown_condition |
| 59 | + ret ptr @callee_with_sideeffects_resolver.default |
| 60 | +} |
| 61 | +define void @callee_with_sideeffects_resolver._Msimd() { |
| 62 | + ret void |
| 63 | +} |
| 64 | +define void @callee_with_sideeffects_resolver.default() { |
| 65 | + ret void |
| 66 | +} |
| 67 | + |
| 68 | +define void @caller() { |
| 69 | + call void @callee_with_trivial_resolver.ifunc() |
| 70 | + call void @callee_with_complex_static_resolver.ifunc() |
| 71 | + call void @callee_with_complex_dynamic_resolver.ifunc() |
| 72 | + call void @callee_with_sideeffects_resolver.ifunc() |
| 73 | + ret void |
| 74 | +} |
| 75 | + |
| 76 | +; CHECK-LABEL: define void @caller() |
| 77 | +; CHECK-NEXT: call void @callee_with_trivial_resolver._Msimd() |
| 78 | +; CHECK-NEXT: call void @callee_with_complex_static_resolver._Msimd() |
| 79 | +; CHECK-NEXT: call void @callee_with_complex_dynamic_resolver.ifunc() |
| 80 | +; CHECK-NEXT: call void @callee_with_sideeffects_resolver.ifunc() |
| 81 | +; CHECK-NEXT: ret void |
0 commit comments