diff options
author | Evan Cheng <evan.cheng@apple.com> | 2010-04-13 22:13:34 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2010-04-13 22:13:34 +0000 |
commit | 6327537a377d2b77748270258e99b257bf1723df (patch) | |
tree | fd1049a7d839de88a6d58ac1d615e56c6d46d43a /lib/CodeGen/MachineLICM.cpp | |
parent | 370aac4a284aa46a530c284539c1df71509a3dc6 (diff) | |
download | external_llvm-6327537a377d2b77748270258e99b257bf1723df.zip external_llvm-6327537a377d2b77748270258e99b257bf1723df.tar.gz external_llvm-6327537a377d2b77748270258e99b257bf1723df.tar.bz2 |
Fast path implicit_def check.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101183 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/MachineLICM.cpp')
-rw-r--r-- | lib/CodeGen/MachineLICM.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/CodeGen/MachineLICM.cpp b/lib/CodeGen/MachineLICM.cpp index 13a4b85..7f530ac 100644 --- a/lib/CodeGen/MachineLICM.cpp +++ b/lib/CodeGen/MachineLICM.cpp @@ -300,7 +300,7 @@ void MachineLICM::ProcessMI(MachineInstr *MI, "Not expecting virtual register!"); if (!MO.isDef()) { - if (PhysRegDefs[Reg]) + if (Reg && PhysRegDefs[Reg]) // If it's using a non-loop-invariant register, then it's obviously not // safe to hoist. HasNonInvariantUse = true; @@ -406,7 +406,7 @@ void MachineLICM::HoistRegionPostRA(MachineDomTreeNode *N) { MachineInstr *MI = Candidates[i].MI; for (unsigned j = 0, ee = MI->getNumOperands(); j != ee; ++j) { const MachineOperand &MO = MI->getOperand(j); - if (!MO.isReg() || MO.isDef()) + if (!MO.isReg() || MO.isDef() || !MO.getReg()) continue; if (PhysRegDefs[MO.getReg()]) { // If it's using a non-loop-invariant register, then it's obviously @@ -502,6 +502,9 @@ void MachineLICM::HoistRegion(MachineDomTreeNode *N) { /// candidate for LICM. e.g. If the instruction is a call, then it's obviously /// not safe to hoist it. bool MachineLICM::IsLICMCandidate(MachineInstr &I) { + if (I.isImplicitDef()) + return false; + const TargetInstrDesc &TID = I.getDesc(); // Ignore stuff that we obviously can't hoist. @@ -620,9 +623,6 @@ bool MachineLICM::isLoadFromConstantMemory(MachineInstr *MI) { /// IsProfitableToHoist - Return true if it is potentially profitable to hoist /// the given loop invariant. bool MachineLICM::IsProfitableToHoist(MachineInstr &MI) { - if (MI.isImplicitDef()) - return false; - // FIXME: For now, only hoist re-materilizable instructions. LICM will // increase register pressure. We want to make sure it doesn't increase // spilling. |