1 # RUN: llc -mtriple=x86_64-- -run-pass=register-coalescer -run-pass=regallocbasic -run-pass=virtregrewriter -late-remat-update-threshold=0 %s -o - | FileCheck %s
3 # PR40061: %t2 = %t1 is rematerialized and %t1 is added into toBeUpdated set
4 # to postpone its live interval update. After the rematerialization, the live
5 # interval of %t1 is larger than necessary. Then %t1 is merged into %t3 and %t1
6 # gets removed. After the merge, %t3 contains live interval larger than
7 # necessary. Because %t3 is not in toBeUpdated set so its live interval is not
8 # updated after register coalescing, and it will break some assumption in
9 # regalloc. This test wants to check the live interval is up-to-date after
10 # register coalescing.
12 # To prevent the test from taking effect only in assert enabled mode, we want
13 # to achieve the test goal without dumping regalloc trace. We add strong hint
14 # to allocate both %t1 and %t2 to $rax register. If the %t1's live interval is
15 # not shrinked properly after register coalescing, %t1 and %t2 will not be
16 # both allocated to $rax because of inference, and we utilize the fact to
17 # achieve the test goal. But note that the assumption only holds when we use
18 # regallocbasic instead of greedy because greedy can update the live interval
19 # in the process of splitting.
21 # CHECK-LABEL: name: foo
23 # CHECK: $rax = MOV64ri32 -11
25 # CHECK: $rax = MOV64ri32 -11
26 # CHECK: $rax = ADD64ri8 killed renamable $rax, 5
27 # CHECK: CMP64ri8 renamable $rax
30 # CHECK: $rax = ADD64ri8 killed renamable $rax, 10
37 successors: %bb.1(0x15555555), %bb.2(0x6aaaaaab)
39 %t1:gr64 = MOV64ri32 -11
40 CMP64ri8 %t1, 1, implicit-def $eflags
41 JCC_1 %bb.2, 4, implicit killed $eflags
45 successors: %bb.1(0x80000000)
48 %t2:gr64 = ADD64ri8 %t2, 5, implicit-def $eflags
50 CMP64ri8 %t2, 1, implicit-def $eflags
51 JCC_1 %bb.1, 4, implicit killed $eflags
55 successors: %bb.3(0x80000000)
57 %t3:gr64 = ADD64ri8 %t3, 10, implicit-def $eflags