forked from OSchip/llvm-project
Don't scan physreg use-def chains looking for a PIC base.
We can't rematerialize a PIC base after register allocation anyway, and scanning physreg use-def chains is very expensive in a function with many calls. <rdar://problem/12047515> llvm-svn: 161461
This commit is contained in:
parent
c0b61ff9c7
commit
3b9a442841
|
@ -1463,6 +1463,9 @@ unsigned X86InstrInfo::isStoreToStackSlotPostFE(const MachineInstr *MI,
|
||||||
/// regIsPICBase - Return true if register is PIC base (i.e.g defined by
|
/// regIsPICBase - Return true if register is PIC base (i.e.g defined by
|
||||||
/// X86::MOVPC32r.
|
/// X86::MOVPC32r.
|
||||||
static bool regIsPICBase(unsigned BaseReg, const MachineRegisterInfo &MRI) {
|
static bool regIsPICBase(unsigned BaseReg, const MachineRegisterInfo &MRI) {
|
||||||
|
// Don't waste compile time scanning use-def chains of physregs.
|
||||||
|
if (!TargetRegisterInfo::isVirtualRegister(BaseReg))
|
||||||
|
return false;
|
||||||
bool isPICBase = false;
|
bool isPICBase = false;
|
||||||
for (MachineRegisterInfo::def_iterator I = MRI.def_begin(BaseReg),
|
for (MachineRegisterInfo::def_iterator I = MRI.def_begin(BaseReg),
|
||||||
E = MRI.def_end(); I != E; ++I) {
|
E = MRI.def_end(); I != E; ++I) {
|
||||||
|
@ -1520,16 +1523,7 @@ X86InstrInfo::isReallyTriviallyReMaterializable(const MachineInstr *MI,
|
||||||
return false;
|
return false;
|
||||||
const MachineFunction &MF = *MI->getParent()->getParent();
|
const MachineFunction &MF = *MI->getParent()->getParent();
|
||||||
const MachineRegisterInfo &MRI = MF.getRegInfo();
|
const MachineRegisterInfo &MRI = MF.getRegInfo();
|
||||||
bool isPICBase = false;
|
return regIsPICBase(BaseReg, MRI);
|
||||||
for (MachineRegisterInfo::def_iterator I = MRI.def_begin(BaseReg),
|
|
||||||
E = MRI.def_end(); I != E; ++I) {
|
|
||||||
MachineInstr *DefMI = I.getOperand().getParent();
|
|
||||||
if (DefMI->getOpcode() != X86::MOVPC32r)
|
|
||||||
return false;
|
|
||||||
assert(!isPICBase && "More than one PIC base?");
|
|
||||||
isPICBase = true;
|
|
||||||
}
|
|
||||||
return isPICBase;
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue