• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# RUN: llc -run-pass postrapseudos -mtriple=i386-apple-macosx -o - %s | FileCheck %s
2
3# Verify that we correctly save and restore eax when copying eflags,
4# even when only a smaller alias of eax is used. We used to check only
5# eax and not its aliases.
6# PR27624.
7
8--- |
9  target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
10
11  define void @foo() {
12  entry:
13    br label %false
14  false:
15    ret void
16  }
17
18...
19
20---
21name:            foo
22allVRegsAllocated: true
23isSSA:           false
24tracksRegLiveness: true
25liveins:
26  - { reg: '%edi' }
27body:             |
28  bb.0.entry:
29    liveins: %edi
30    successors: %bb.1.false
31    NOOP implicit-def %al
32
33    ; The bug was triggered only when LivePhysReg is used, which
34    ; happens only when the heuristic for the liveness computation
35    ; failed. The liveness computation heuristic looks at 10 instructions
36    ; before and after the copy. Make sure we do not reach the definition of
37    ; AL in 10 instructions, otherwise the heuristic will see that it is live.
38    NOOP
39    NOOP
40    NOOP
41    NOOP
42    NOOP
43    NOOP
44    NOOP
45    NOOP
46    NOOP
47    NOOP
48    NOOP
49    NOOP
50    NOOP
51    ; Save AL.
52    ; CHECK: PUSH32r killed %eax
53
54    ; Copy EDI into EFLAGS
55    ; CHECK-NEXT: %eax = MOV32rr %edi
56    ; CHECK-NEXT: %al = ADD8ri %al, 127, implicit-def %eflags
57    ; CHECK-NEXT: SAHF implicit-def %eflags, implicit %ah
58    %eflags = COPY %edi
59
60    ; Restore AL.
61    ; CHECK-NEXT: %eax = POP32r
62  bb.1.false:
63    liveins: %al
64    NOOP implicit %al
65    RETQ
66
67...
68