File: regalloc-spill-at-ehpad.ll

package info (click to toggle)
llvm-toolchain-17 1%3A17.0.6-22
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, 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 (72 lines) | stat: -rw-r--r-- 2,765 bytes parent folder | download | duplicates (13)
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
; RUN: llc -regalloc=greedy -mtriple=x86_64-pc-windows-msvc  < %s -o - | FileCheck %s

; This test checks for proper handling of a condition where the greedy register
; allocator encounters a very short interval that contains no uses but does
; contain an EH pad unwind edge, which requires spilling.  Previously the
; register allocator marked a interval like this as unspillable, resulting in
; a compilation failure.


; The following checks that the value %p is reloaded within the catch handler.
; CHECK-LABEL: "?catch$8@?0?test@4HA":
; CHECK:           .seh_endprologue
; CHECK:           movq    -16(%rbp), %rax
; CHECK:           movb    $0, (%rax)

define ptr @test(ptr %a) personality ptr @__CxxFrameHandler3 {
entry:
  %call = call i32 @f()
  br i1 undef, label %if.end, label %if.else

if.else:                                          ; preds = %entry
  br i1 undef, label %cond.false.i, label %if.else.else

if.else.else:                                     ; preds = %if.else
  br i1 undef, label %cond.true.i, label %cond.false.i

cond.true.i:                                      ; preds = %if.else.else
  br label %invoke.cont

cond.false.i:                                     ; preds = %if.else.else, %if.else
  %call.i = invoke i32 @f()
          to label %invoke.cont unwind label %catch.dispatch

catch.dispatch:                                   ; preds = %cond.false.i
  %tmp0 = catchswitch within none [label %catch] unwind label %ehcleanup

catch:                                            ; preds = %catch.dispatch
  %tmp1 = catchpad within %tmp0 [ptr null, i32 64, ptr null]
  store i8 0, ptr %a, align 8
  invoke void @_CxxThrowException(ptr null, ptr null) [ "funclet"(token %tmp1) ]
          to label %noexc unwind label %ehcleanup

noexc:                                            ; preds = %catch
  unreachable

invoke.cont:                                      ; preds = %cond.false.i, %cond.true.i
  %cond.i = phi i32 [ %call, %cond.true.i ], [ %call.i, %cond.false.i ]
  %cmp = icmp eq i32 %cond.i, -1
  %tmp3 = select i1 %cmp, i32 4, i32 0
  br label %if.end

if.end:                                           ; preds = %invoke.cont, %entry
  %state.0 = phi i32 [ %tmp3, %invoke.cont ], [ 4, %entry ]
  invoke void @g(ptr %a, i32 %state.0)
          to label %invoke.cont.1 unwind label %ehcleanup

invoke.cont.1:                                    ; preds = %if.end
  ret ptr %a

ehcleanup:                                        ; preds = %if.end, %catch, %catch.dispatch
  %tmp4 = cleanuppad within none []
  cleanupret from %tmp4 unwind to caller
}

%eh.ThrowInfo = type { i32, i32, i32, i32 }

declare i32 @__CxxFrameHandler3(...)

declare void @_CxxThrowException(ptr, ptr)

declare i32 @f()
declare void @g(ptr, i32)