mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-07 12:28:24 +00:00
Add a hidden option to PHIElimination to split all critical edges. This is
particularly useful for catching issues with architectures that have exotic terminators like MIPS. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174938 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -40,6 +40,11 @@ DisableEdgeSplitting("disable-phi-elim-edge-splitting", cl::init(false),
|
|||||||
cl::Hidden, cl::desc("Disable critical edge splitting "
|
cl::Hidden, cl::desc("Disable critical edge splitting "
|
||||||
"during PHI elimination"));
|
"during PHI elimination"));
|
||||||
|
|
||||||
|
static cl::opt<bool>
|
||||||
|
SplitAllCriticalEdges("phi-elim-split-all-critical-edges", cl::init(false),
|
||||||
|
cl::Hidden, cl::desc("Split all critical edges during "
|
||||||
|
"PHI elimination"));
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
class PHIElimination : public MachineFunctionPass {
|
class PHIElimination : public MachineFunctionPass {
|
||||||
MachineRegisterInfo *MRI; // Machine register information
|
MachineRegisterInfo *MRI; // Machine register information
|
||||||
@@ -550,10 +555,10 @@ bool PHIElimination::SplitPHIEdges(MachineFunction &MF,
|
|||||||
|
|
||||||
// Avoid splitting backedges of loops. It would introduce small
|
// Avoid splitting backedges of loops. It would introduce small
|
||||||
// out-of-line blocks into the loop which is very bad for code placement.
|
// out-of-line blocks into the loop which is very bad for code placement.
|
||||||
if (PreMBB == &MBB)
|
if (PreMBB == &MBB && !SplitAllCriticalEdges)
|
||||||
continue;
|
continue;
|
||||||
const MachineLoop *PreLoop = MLI ? MLI->getLoopFor(PreMBB) : 0;
|
const MachineLoop *PreLoop = MLI ? MLI->getLoopFor(PreMBB) : 0;
|
||||||
if (IsLoopHeader && PreLoop == CurLoop)
|
if (IsLoopHeader && PreLoop == CurLoop && !SplitAllCriticalEdges)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// LV doesn't consider a phi use live-out, so isLiveOut only returns true
|
// LV doesn't consider a phi use live-out, so isLiveOut only returns true
|
||||||
@@ -562,7 +567,7 @@ bool PHIElimination::SplitPHIEdges(MachineFunction &MF,
|
|||||||
// there is a risk it may not be coalesced away.
|
// there is a risk it may not be coalesced away.
|
||||||
//
|
//
|
||||||
// If the copy would be a kill, there is no need to split the edge.
|
// If the copy would be a kill, there is no need to split the edge.
|
||||||
if (!isLiveOutPastPHIs(Reg, PreMBB))
|
if (!isLiveOutPastPHIs(Reg, PreMBB) && !SplitAllCriticalEdges)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
DEBUG(dbgs() << PrintReg(Reg) << " live-out before critical edge BB#"
|
DEBUG(dbgs() << PrintReg(Reg) << " live-out before critical edge BB#"
|
||||||
@@ -577,7 +582,7 @@ bool PHIElimination::SplitPHIEdges(MachineFunction &MF,
|
|||||||
// is likely to be left after coalescing. If we are looking at a loop
|
// is likely to be left after coalescing. If we are looking at a loop
|
||||||
// exiting edge, split it so we won't insert code in the loop, otherwise
|
// exiting edge, split it so we won't insert code in the loop, otherwise
|
||||||
// don't bother.
|
// don't bother.
|
||||||
bool ShouldSplit = !isLiveIn(Reg, &MBB);
|
bool ShouldSplit = !isLiveIn(Reg, &MBB) || SplitAllCriticalEdges;
|
||||||
|
|
||||||
// Check for a loop exiting edge.
|
// Check for a loop exiting edge.
|
||||||
if (!ShouldSplit && CurLoop != PreLoop) {
|
if (!ShouldSplit && CurLoop != PreLoop) {
|
||||||
|
Reference in New Issue
Block a user