mirror of
https://github.com/RPCSX/llvm.git
synced 2025-01-09 13:41:35 +00:00
5e0f621a7b
This fixes a bug introduced in r267623, where we got smarter and avoided to save EAX before using it. However, we failed to check if any of the subregister of EAX were alive and thus, missed cases where we have to save EAX before using it. The problem may happen on every X86/i386/... platform. This fixes llvm.org/PR27624 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269115 91177308-0d34-0410-b5e6-96231b3b80d8
68 lines
1.5 KiB
YAML
68 lines
1.5 KiB
YAML
# RUN: llc -run-pass postrapseudos -mtriple=i386-apple-macosx -o /dev/null %s 2>&1 | FileCheck %s
|
|
|
|
# Verify that we correctly save and restore eax when copying eflags,
|
|
# even when only a smaller alias of eax is used. We used to check only
|
|
# eax and not its aliases.
|
|
# PR27624.
|
|
|
|
--- |
|
|
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
|
|
|
|
define void @foo() {
|
|
entry:
|
|
br label %false
|
|
false:
|
|
ret void
|
|
}
|
|
|
|
...
|
|
|
|
---
|
|
name: foo
|
|
allVRegsAllocated: true
|
|
isSSA: false
|
|
tracksRegLiveness: true
|
|
liveins:
|
|
- { reg: '%edi' }
|
|
body: |
|
|
bb.0.entry:
|
|
liveins: %edi
|
|
successors: %bb.1.false
|
|
NOOP implicit-def %al
|
|
|
|
; The bug was triggered only when LivePhysReg is used, which
|
|
; happens only when the heuristic for the liveness computation
|
|
; failed. The liveness computation heuristic looks at 10 instructions
|
|
; before and after the copy. Make sure we do not reach the definition of
|
|
; AL in 10 instructions, otherwise the heuristic will see that it is live.
|
|
NOOP
|
|
NOOP
|
|
NOOP
|
|
NOOP
|
|
NOOP
|
|
NOOP
|
|
NOOP
|
|
NOOP
|
|
NOOP
|
|
NOOP
|
|
NOOP
|
|
NOOP
|
|
NOOP
|
|
; Save AL.
|
|
; CHECK: PUSH32r killed %eax
|
|
|
|
; Copy EDI into EFLAGS
|
|
; CHECK-NEXT: %eax = MOV32rr %edi
|
|
; CHECK-NEXT: %al = ADD8ri %al, 127, implicit-def %eflags
|
|
; CHECK-NEXT: SAHF implicit-def %eflags, implicit %ah
|
|
%eflags = COPY %edi
|
|
|
|
; Restore AL.
|
|
; CHECK-NEXT: %eax = POP32r
|
|
bb.1.false:
|
|
liveins: %al
|
|
NOOP implicit %al
|
|
RETQ
|
|
|
|
...
|