xref: /llvm-project/llvm/test/Transforms/LowerTypeTests/icall-branch-funnel.ll (revision d3d7ba12033f20dfbc8eb6c60954478cff0d0182)
1; RUN: opt -S -passes=lowertypetests %s | FileCheck %s
2
3target datalayout = "e-p:64:64"
4target triple = "x86_64-unknown-linux"
5
6; CHECK: @0 = private constant { i32, [0 x i8], i32 } { i32 1, [0 x i8] zeroinitializer, i32 2 }
7; CHECK: @g1 = alias i32, ptr @0
8; CHECK: @g2 = alias i32, getelementptr inbounds ({ i32, [0 x i8], i32 }, ptr @0, i32 0, i32 2)
9; CHECK: @f1 = alias void (), ptr @.cfi.jumptable
10; CHECK: @f2 = alias void (), getelementptr inbounds ([2 x [8 x i8]], ptr @.cfi.jumptable, i64 0, i64 1)
11
12@g1 = constant i32 1
13@g2 = constant i32 2
14
15define void @f1() {
16  ret void
17}
18
19define void @f2() {
20  ret void
21}
22
23declare void @g1f()
24declare void @g2f()
25
26define void @jt2(ptr nest, ...) {
27  musttail call void (...) @llvm.icall.branch.funnel(
28      ptr %0,
29      ptr @g1, ptr @g1f,
30      ptr @g2, ptr @g2f,
31      ...
32  )
33  ret void
34}
35
36define void @jt3(ptr nest, ...) {
37  musttail call void (...) @llvm.icall.branch.funnel(
38      ptr %0,
39      ptr @f1, ptr @f1,
40      ptr @f2, ptr @f2,
41      ...
42  )
43  ret void
44}
45
46declare void @llvm.icall.branch.funnel(...)
47