File: win-import-call-optimization-jumptable.ll

package info (click to toggle)
llvm-toolchain-21 1%3A21.1.4-5
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,236,516 kB
  • sloc: cpp: 7,619,569; ansic: 1,433,956; asm: 1,058,748; python: 252,181; f90: 94,671; objc: 70,753; lisp: 42,813; pascal: 18,401; sh: 8,601; ml: 5,111; perl: 4,720; makefile: 3,585; awk: 3,523; javascript: 2,272; xml: 892; fortran: 770
file content (83 lines) | stat: -rw-r--r-- 1,579 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
; RUN: llc -mtriple=x86_64-pc-windows-msvc < %s | FileCheck %s

; CHECK-LABEL:  uses_rax:
; CHECK:        .Limpcall0:
; CHECK-NEXT:     jmpq    *%rax

define void @uses_rax(i32 %x) {
entry:
  switch i32 %x, label %sw.epilog [
    i32 0, label %sw.bb
    i32 1, label %sw.bb1
    i32 2, label %sw.bb2
    i32 3, label %sw.bb3
  ]

sw.bb:
  tail call void @g(i32 0) #2
  br label %sw.epilog

sw.bb1:
  tail call void @g(i32 1) #2
  br label %sw.epilog

sw.bb2:
  tail call void @g(i32 2) #2
  br label %sw.epilog

sw.bb3:
  tail call void @g(i32 3) #2
  br label %sw.epilog

sw.epilog:
  tail call void @g(i32 10) #2
  ret void
}

; CHECK-LABEL:  uses_rcx:
; CHECK:        .Limpcall1:
; CHECK-NEXT:     jmpq    *%rcx

define void @uses_rcx(i32 %x) {
entry:
  switch i32 %x, label %sw.epilog [
    i32 10, label %sw.bb
    i32 11, label %sw.bb1
    i32 12, label %sw.bb2
    i32 13, label %sw.bb3
  ]

sw.bb:
  tail call void @g(i32 0) #2
  br label %sw.epilog

sw.bb1:
  tail call void @g(i32 1) #2
  br label %sw.epilog

sw.bb2:
  tail call void @g(i32 2) #2
  br label %sw.epilog

sw.bb3:
  tail call void @g(i32 3) #2
  br label %sw.epilog

sw.epilog:
  tail call void @g(i32 10) #2
  ret void
}

declare void @g(i32)

; CHECK-LABEL:  .section        .retplne,"yi"
; CHECK-NEXT:   .asciz  "RetpolineV1"
; CHECK-NEXT:   .long   24
; CHECK-NEXT:   .secnum .text
; CHECK-NEXT:   .long   16
; CHECK-NEXT:   .secoffset      .Limpcall0
; CHECK-NEXT:   .long   17
; CHECK-NEXT:   .secoffset      .Limpcall1

!llvm.module.flags = !{!0}
!0 = !{i32 1, !"import-call-optimization", i32 1}