File: 2013-02-19-tail-call-register-hint.ll

package info (click to toggle)
llvm-toolchain-17 1%3A17.0.6-22
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 1,799,624 kB
  • sloc: cpp: 6,428,607; ansic: 1,383,196; asm: 793,408; python: 223,504; objc: 75,364; f90: 60,502; lisp: 33,869; pascal: 15,282; sh: 9,684; perl: 7,453; ml: 4,937; awk: 3,523; makefile: 2,889; javascript: 2,149; xml: 888; fortran: 619; cs: 573
file content (45 lines) | stat: -rw-r--r-- 1,502 bytes parent folder | download | duplicates (16)
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
; RUN: llc < %s -mtriple=thumbv7s-apple-ios6.0.0 -verify-machineinstrs

; Check to make sure the tail-call return at the end doesn't use a
; callee-saved register. Register hinting from t2LDRDri was getting this
; wrong. The intervening call will force allocation to try a high register
; first, so the hint will attempt to fire, but must be rejected due to
; not being in the allocation order for the tcGPR register class.
; The machine instruction verifier will make sure that all actually worked
; out the way it's supposed to.

%"myclass" = type { %struct.foo }
%struct.foo = type { i32, [40 x i8] }

define hidden void @func(ptr %Data) nounwind ssp {
  %1 = getelementptr inbounds i8, ptr %Data, i32 12
  tail call void @abc(ptr %1) nounwind
  tail call void @def(ptr %1) nounwind
  %2 = getelementptr inbounds i8, ptr %Data, i32 8
  %3 = load ptr, ptr %2, align 4
  tail call void @ghi(ptr %3) nounwind
  %4 = load ptr, ptr %Data, align 4
  %5 = getelementptr inbounds i8, ptr %Data, i32 4
  %6 = load ptr, ptr %5, align 4
  %7 = icmp eq ptr %Data, null
  br i1 %7, label %10, label %8

; <label>:12                                      ; preds = %0
  %9 = tail call ptr @jkl(ptr %1) nounwind
  tail call void @mno(ptr %Data) nounwind
  br label %10

; <label>:14                                      ; preds = %8, %0
  tail call void %4(ptr %6) nounwind
  ret void
}

declare void @mno(ptr)

declare void @def(ptr)

declare void @abc(ptr)

declare void @ghi(ptr)

declare ptr @jkl(ptr) nounwind