DBG_VALUE does not have any side effects; it also makes no sense to mark it cheap as a copy.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123031 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Evan Cheng 2011-01-07 21:08:26 +00:00
parent eaff66a895
commit 30a343aeed
4 changed files with 9 additions and 4 deletions

View File

@ -484,7 +484,7 @@ def DBG_VALUE : Instruction {
let OutOperandList = (outs);
let InOperandList = (ins variable_ops);
let AsmString = "DBG_VALUE";
let isAsCheapAsAMove = 1;
let neverHasSideEffects = 1;
}
def REG_SEQUENCE : Instruction {
let OutOperandList = (outs unknown:$dst);

View File

@ -1115,7 +1115,9 @@ bool MachineInstr::isSafeToMove(const TargetInstrInfo *TII,
SawStore = true;
return false;
}
if (TID->isTerminator() || TID->hasUnmodeledSideEffects())
if (isLabel() || isDebugValue() ||
TID->isTerminator() || TID->hasUnmodeledSideEffects())
return false;
// See if this instruction does a load. If so, we have to guarantee that the

View File

@ -336,7 +336,9 @@ bool PeepholeOptimizer::runOnMachineFunction(MachineFunction &MF) {
MachineInstr *MI = &*MII++;
LocalMIs.insert(MI);
if (MI->getDesc().hasUnmodeledSideEffects())
if (MI->isLabel() || MI->isPHI() || MI->isImplicitDef() ||
MI->isKill() || MI->isInlineAsm() || MI->isDebugValue() ||
MI->getDesc().hasUnmodeledSideEffects())
continue;
if (MI->getDesc().isCompare()) {

View File

@ -1620,7 +1620,8 @@ static bool isSafeToDelete(MachineInstr &MI) {
const TargetInstrDesc &TID = MI.getDesc();
if (TID.mayLoad() || TID.mayStore() || TID.isCall() || TID.isTerminator() ||
TID.isCall() || TID.isBarrier() || TID.isReturn() ||
TID.hasUnmodeledSideEffects())
TID.hasUnmodeledSideEffects() ||
MI.isLabel() || MI.isDebugValue())
return false;
for (unsigned i = 0, e = MI.getNumOperands(); i != e; ++i) {
MachineOperand &MO = MI.getOperand(i);