mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-22 07:32:48 +00:00
e4b44c1617
Per original comment, the intention of this loop is to go ahead and break the critical edge (in order to sink this instruction) if there's reason to believe doing so might "unblock" the sinking of additional instructions that define registers used by this one. The idea is that if we have a few instructions to sink "together" breaking the edge might be worthwhile. This commit makes a few small changes to help better realize this goal: First, modify the loop to ignore registers defined by this instruction. We don't sink definitions of physical registers, and sinking an SSA definition isn't going to unblock an upstream instruction. Second, ignore uses of physical registers. Instructions that define physical registers are rejected for sinking, and so moving this one won't enable moving any defining instructions. As an added bonus, while virtual register use-def chains are generally small due to SSA goodness, iteration over the uses and definitions (used by hasOneNonDBGUse) for physical registers like EFLAGS can be rather expensive in practice. (This is the original reason for looking at this) Finally, to keep things simple continue to only consider this trick for registers that have a single use (via hasOneNonDBGUse), but to avoid spuriously breaking critical edges only do so if the definition resides in the same MBB and therefore this one directly blocks it from being sunk as well. If sinking them together is meant to be, let the iterative nature of this pass sink the definition into this block first. Update tests to accomodate this change, add new testcase where sinking avoids pipeline stalls. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192608 91177308-0d34-0410-b5e6-96231b3b80d8
39 lines
1.1 KiB
LLVM
39 lines
1.1 KiB
LLVM
; RUN: llc < %s -mtriple=x86_64-apple-macosx | FileCheck %s
|
|
; This is supposed to be testing BranchFolding's common
|
|
; code hoisting logic, but has been erroneously passing due
|
|
; to there being a redundant xorl in the entry block
|
|
; and no common code to hoist.
|
|
; However, now that MachineSink sinks the redundant xor
|
|
; hoist-common looks at it and rejects it for hoisting,
|
|
; which causes this test to fail.
|
|
; Since it seems this test is broken, marking XFAIL for now
|
|
; until someone decides to remove it or fix what it tests.
|
|
; XFAIL: *
|
|
|
|
; Common "xorb al, al" instruction in the two successor blocks should be
|
|
; moved to the entry block above the test + je.
|
|
|
|
; rdar://9145558
|
|
|
|
define zeroext i1 @t(i32 %c) nounwind ssp {
|
|
entry:
|
|
; CHECK-LABEL: t:
|
|
; CHECK: xorl %eax, %eax
|
|
; CHECK: test
|
|
; CHECK: je
|
|
%tobool = icmp eq i32 %c, 0
|
|
br i1 %tobool, label %return, label %if.then
|
|
|
|
if.then:
|
|
; CHECK: callq
|
|
%call = tail call zeroext i1 (...)* @foo() nounwind
|
|
br label %return
|
|
|
|
return:
|
|
; CHECK: ret
|
|
%retval.0 = phi i1 [ %call, %if.then ], [ false, %entry ]
|
|
ret i1 %retval.0
|
|
}
|
|
|
|
declare zeroext i1 @foo(...)
|