forked from OSchip/llvm-project
parent
8d64226efe
commit
8781b35be5
|
@ -130,7 +130,7 @@ bool MachineLICM::runOnMachineFunction(MachineFunction &MF) {
|
||||||
if (F->hasFnAttr(Attribute::OptimizeForSize))
|
if (F->hasFnAttr(Attribute::OptimizeForSize))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
DOUT << "******** Machine LICM ********\n";
|
DEBUG(errs() << "******** Machine LICM ********\n");
|
||||||
|
|
||||||
Changed = false;
|
Changed = false;
|
||||||
TM = &MF.getTarget();
|
TM = &MF.getTarget();
|
||||||
|
@ -218,28 +218,28 @@ bool MachineLICM::IsLoopInvariantInst(MachineInstr &I) {
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG({
|
DEBUG({
|
||||||
DOUT << "--- Checking if we can hoist " << I;
|
errs() << "--- Checking if we can hoist " << I;
|
||||||
if (I.getDesc().getImplicitUses()) {
|
if (I.getDesc().getImplicitUses()) {
|
||||||
DOUT << " * Instruction has implicit uses:\n";
|
errs() << " * Instruction has implicit uses:\n";
|
||||||
|
|
||||||
const TargetRegisterInfo *TRI = TM->getRegisterInfo();
|
const TargetRegisterInfo *TRI = TM->getRegisterInfo();
|
||||||
for (const unsigned *ImpUses = I.getDesc().getImplicitUses();
|
for (const unsigned *ImpUses = I.getDesc().getImplicitUses();
|
||||||
*ImpUses; ++ImpUses)
|
*ImpUses; ++ImpUses)
|
||||||
DOUT << " -> " << TRI->getName(*ImpUses) << "\n";
|
errs() << " -> " << TRI->getName(*ImpUses) << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (I.getDesc().getImplicitDefs()) {
|
if (I.getDesc().getImplicitDefs()) {
|
||||||
DOUT << " * Instruction has implicit defines:\n";
|
errs() << " * Instruction has implicit defines:\n";
|
||||||
|
|
||||||
const TargetRegisterInfo *TRI = TM->getRegisterInfo();
|
const TargetRegisterInfo *TRI = TM->getRegisterInfo();
|
||||||
for (const unsigned *ImpDefs = I.getDesc().getImplicitDefs();
|
for (const unsigned *ImpDefs = I.getDesc().getImplicitDefs();
|
||||||
*ImpDefs; ++ImpDefs)
|
*ImpDefs; ++ImpDefs)
|
||||||
DOUT << " -> " << TRI->getName(*ImpDefs) << "\n";
|
errs() << " -> " << TRI->getName(*ImpDefs) << "\n";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (I.getDesc().getImplicitDefs() || I.getDesc().getImplicitUses()) {
|
if (I.getDesc().getImplicitDefs() || I.getDesc().getImplicitUses()) {
|
||||||
DOUT << "Cannot hoist with implicit defines or uses\n";
|
DEBUG(errs() << "Cannot hoist with implicit defines or uses\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -374,8 +374,7 @@ void MachineLICM::Hoist(MachineInstr &MI) {
|
||||||
if (CI != CSEMap.end()) {
|
if (CI != CSEMap.end()) {
|
||||||
const MachineInstr *Dup = LookForDuplicate(&MI, CI->second, RegInfo);
|
const MachineInstr *Dup = LookForDuplicate(&MI, CI->second, RegInfo);
|
||||||
if (Dup) {
|
if (Dup) {
|
||||||
DOUT << "CSEing " << MI;
|
DEBUG(errs() << "CSEing " << MI << " with " << *Dup);
|
||||||
DOUT << " with " << *Dup;
|
|
||||||
for (unsigned i = 0, e = MI.getNumOperands(); i != e; ++i) {
|
for (unsigned i = 0, e = MI.getNumOperands(); i != e; ++i) {
|
||||||
const MachineOperand &MO = MI.getOperand(i);
|
const MachineOperand &MO = MI.getOperand(i);
|
||||||
if (MO.isReg() && MO.isDef())
|
if (MO.isReg() && MO.isDef())
|
||||||
|
|
Loading…
Reference in New Issue