aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/MachineLICM.cpp
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2007-12-11 18:45:11 +0000
committerBill Wendling <isanbard@gmail.com>2007-12-11 18:45:11 +0000
commit650b0527a495acbf7d6ee3343e8c41fae1686148 (patch)
treea827744c35e521f266ed5d95153e27c0cba154fd /lib/CodeGen/MachineLICM.cpp
parent6e041c2015dc25140b20e09ed7adbc9b8d6dc62b (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44871 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/MachineLICM.cpp')
-rw-r--r--lib/CodeGen/MachineLICM.cpp15
1 files changed, 4 insertions, 11 deletions
diff --git a/lib/CodeGen/MachineLICM.cpp b/lib/CodeGen/MachineLICM.cpp
index c66e0620bc..b158e90f16 100644
--- a/lib/CodeGen/MachineLICM.cpp
+++ b/lib/CodeGen/MachineLICM.cpp
@@ -99,13 +99,7 @@ namespace {
///
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 @@ namespace {
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 @@ namespace {
/// 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