mirror of
https://github.com/RPCSX/llvm.git
synced 2025-02-14 01:40:53 +00:00
Teach isSafeToClobberEFLAGS to ignore dbg_value's. We need a MachineBasicBlock::iterator that does this automatically?
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99320 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
112e5e7eff
commit
8d1f0dd983
@ -992,8 +992,10 @@ X86InstrInfo::isReallyTriviallyReMaterializable(const MachineInstr *MI,
|
|||||||
/// a few instructions in each direction it assumes it's not safe.
|
/// a few instructions in each direction it assumes it's not safe.
|
||||||
static bool isSafeToClobberEFLAGS(MachineBasicBlock &MBB,
|
static bool isSafeToClobberEFLAGS(MachineBasicBlock &MBB,
|
||||||
MachineBasicBlock::iterator I) {
|
MachineBasicBlock::iterator I) {
|
||||||
|
MachineBasicBlock::iterator E = MBB.end();
|
||||||
|
|
||||||
// It's always safe to clobber EFLAGS at the end of a block.
|
// It's always safe to clobber EFLAGS at the end of a block.
|
||||||
if (I == MBB.end())
|
if (I == E)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// For compile time consideration, if we are not able to determine the
|
// For compile time consideration, if we are not able to determine the
|
||||||
@ -1017,20 +1019,28 @@ static bool isSafeToClobberEFLAGS(MachineBasicBlock &MBB,
|
|||||||
// This instruction defines EFLAGS, no need to look any further.
|
// This instruction defines EFLAGS, no need to look any further.
|
||||||
return true;
|
return true;
|
||||||
++Iter;
|
++Iter;
|
||||||
|
// Skip over DBG_VALUE.
|
||||||
|
while (Iter != E && Iter->isDebugValue())
|
||||||
|
++Iter;
|
||||||
|
|
||||||
// If we make it to the end of the block, it's safe to clobber EFLAGS.
|
// If we make it to the end of the block, it's safe to clobber EFLAGS.
|
||||||
if (Iter == MBB.end())
|
if (Iter == E)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MachineBasicBlock::iterator B = MBB.begin();
|
||||||
Iter = I;
|
Iter = I;
|
||||||
for (unsigned i = 0; i < 4; ++i) {
|
for (unsigned i = 0; i < 4; ++i) {
|
||||||
// If we make it to the beginning of the block, it's safe to clobber
|
// If we make it to the beginning of the block, it's safe to clobber
|
||||||
// EFLAGS iff EFLAGS is not live-in.
|
// EFLAGS iff EFLAGS is not live-in.
|
||||||
if (Iter == MBB.begin())
|
if (Iter == B)
|
||||||
return !MBB.isLiveIn(X86::EFLAGS);
|
return !MBB.isLiveIn(X86::EFLAGS);
|
||||||
|
|
||||||
--Iter;
|
--Iter;
|
||||||
|
// Skip over DBG_VALUE.
|
||||||
|
while (Iter != B && Iter->isDebugValue())
|
||||||
|
--Iter;
|
||||||
|
|
||||||
bool SawKill = false;
|
bool SawKill = false;
|
||||||
for (unsigned j = 0, e = Iter->getNumOperands(); j != e; ++j) {
|
for (unsigned j = 0, e = Iter->getNumOperands(); j != e; ++j) {
|
||||||
MachineOperand &MO = Iter->getOperand(j);
|
MachineOperand &MO = Iter->getOperand(j);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user