11; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
22; RUN: llc -mtriple=x86_64 -exception-model=sjlj -o - %s | FileCheck %s
33
4- declare dso_local i32 @__gxx_personality_sj0 (...)
5- declare dso_local preserve_allcc void @foo (ptr )
4+ declare i32 @__gxx_personality_sj0 (...)
5+ declare preserve_allcc void @foo (ptr )
6+
7+ ; Check that register allocator splits live ranges of loop invariant virtual
8+ ; registers as they don't survive the unwind edge of an invoke.
9+ ; The argument of `foo` (passed in %rdi) and the address of the jump table
10+ ; (base register of `jmpq`) are loop invariant. They survive the call to `foo`,
11+ ; but are clobbered by the unwinder when `foo` throws an exception, and so
12+ ; their live ranges must be split around the unwind edge `callq foo` -> LBB0_3.
13+ ; This is achieved by recalculating their values before each use rather than
14+ ; once before the loop as was the case before register allocation.
615
716define void @test () personality ptr @__gxx_personality_sj0 {
817; CHECK-LABEL: test:
@@ -15,7 +24,8 @@ define void @test() personality ptr @__gxx_personality_sj0 {
1524; CHECK-NEXT: pushq %r12
1625; CHECK-NEXT: pushq %rbx
1726; CHECK-NEXT: subq $104, %rsp
18- ; CHECK-NEXT: movq $__gxx_personality_sj0, -104(%rbp)
27+ ; CHECK-NEXT: movq __gxx_personality_sj0@GOTPCREL(%rip), %rax
28+ ; CHECK-NEXT: movq %rax, -104(%rbp)
1929; CHECK-NEXT: movq $GCC_except_table0, -96(%rbp)
2030; CHECK-NEXT: movq %rbp, -88(%rbp)
2131; CHECK-NEXT: movq %rsp, -72(%rbp)
@@ -28,7 +38,7 @@ define void @test() personality ptr @__gxx_personality_sj0 {
2838; CHECK-NEXT: movl $1, -128(%rbp)
2939; CHECK-NEXT: .Ltmp0:
3040; CHECK-NEXT: movq %rcx, %rdi
31- ; CHECK-NEXT: callq foo
41+ ; CHECK-NEXT: callq foo@PLT
3242; CHECK-NEXT: .Ltmp1:
3343; CHECK-NEXT: jmp .LBB0_2
3444; CHECK-NEXT: .LBB0_3: # in Loop: Header=BB0_1 Depth=1
0 commit comments