Microoptimize getVRegDef. def_begin isn't free, don't compute it twice.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152492 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Benjamin Kramer 2012-03-10 12:50:44 +00:00
parent 84dfc32ff9
commit 1e8db1a4fa

View File

@ -161,9 +161,8 @@ void MachineRegisterInfo::replaceRegWith(unsigned FromReg, unsigned ToReg) {
/// form, so there should only be one definition.
MachineInstr *MachineRegisterInfo::getVRegDef(unsigned Reg) const {
// Since we are in SSA form, we can use the first definition.
if (!def_empty(Reg))
return &*def_begin(Reg);
return 0;
def_iterator I = def_begin(Reg);
return !I.atEnd() ? &*I : 0;
}
bool MachineRegisterInfo::hasOneUse(unsigned RegNo) const {