Author: void Date: Tue Dec 11 12:45:11 2007 New Revision: 44871 URL: http://llvm.org/viewvc/llvm-project?rev=44871&view=rev Log: Checking for "zero operands" during the "CanHoistInst()" method isn't necessary because those with side effects will be caught by other checks in here.
Also, simplify the check for a BB in a sub loop. Modified: llvm/trunk/lib/CodeGen/MachineLICM.cpp Modified: llvm/trunk/lib/CodeGen/MachineLICM.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineLICM.cpp?rev=44871&r1=44870&r2=44871&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineLICM.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineLICM.cpp Tue Dec 11 12:45:11 2007 @@ -99,13 +99,7 @@ /// bool IsInSubLoop(MachineBasicBlock *BB) { assert(CurLoop->contains(BB) && "Only valid if BB is IN the loop"); - - for (MachineLoop::iterator - I = CurLoop->begin(), E = CurLoop->end(); I != E; ++I) - if ((*I)->contains(BB)) - return true; // A subloop actually contains this block! - - return false; + return LI->getLoopFor(BB) != CurLoop; } /// CanHoistInst - Checks that this instructions is one that can be hoisted @@ -115,9 +109,8 @@ bool CanHoistInst(MachineInstr &I) const { const TargetInstrDescriptor *TID = I.getInstrDescriptor(); - // Don't hoist if this instruction implicitly reads physical registers or - // doesn't take any operands. - if (TID->ImplicitUses || !I.getNumOperands()) return false; + // Don't hoist if this instruction implicitly reads physical registers. + if (TID->ImplicitUses) return false; MachineOpCode Opcode = TID->Opcode; return TII->isTriviallyReMaterializable(&I) && @@ -142,7 +135,7 @@ /// FindPredecessors - Get all of the predecessors of the loop that are not /// back-edges. /// - void FindPredecessors(std::vector<MachineBasicBlock*> &Preds){ + void FindPredecessors(std::vector<MachineBasicBlock*> &Preds) { const MachineBasicBlock *Header = CurLoop->getHeader(); for (MachineBasicBlock::const_pred_iterator _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits