diff options
author | Chris Lattner <sabre@nondot.org> | 2010-07-12 00:00:35 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-07-12 00:00:35 +0000 |
commit | 0b7ae20a35187bb53372e2b156ddb72fe8734615 (patch) | |
tree | ddca29f9e994d8233cc98580ee365bcf68e890e9 /llvm/lib/CodeGen/MachineLICM.cpp | |
parent | 33919e7450530e64804651c25a306cff548b39fb (diff) | |
download | bcm5719-llvm-0b7ae20a35187bb53372e2b156ddb72fe8734615.tar.gz bcm5719-llvm-0b7ae20a35187bb53372e2b156ddb72fe8734615.zip |
change machinelicm to use MachineInstr::isSafeToMove. No
intended functionality change.
The avoidance of hoistiing implicitdef seems wrong though.
llvm-svn: 108109
Diffstat (limited to 'llvm/lib/CodeGen/MachineLICM.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineLICM.cpp | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/llvm/lib/CodeGen/MachineLICM.cpp b/llvm/lib/CodeGen/MachineLICM.cpp index 709b2d1587a..956d21c0b34 100644 --- a/llvm/lib/CodeGen/MachineLICM.cpp +++ b/llvm/lib/CodeGen/MachineLICM.cpp @@ -127,8 +127,8 @@ namespace { void AddToLiveIns(unsigned Reg); /// IsLICMCandidate - Returns true if the instruction may be a suitable - /// candidate for LICM. e.g. If the instruction is a call, then it's obviously - /// not safe to hoist it. + /// candidate for LICM. e.g. If the instruction is a call, then it's + /// obviously not safe to hoist it. bool IsLICMCandidate(MachineInstr &I); /// IsLoopInvariantInst - Returns true if the instruction is loop @@ -497,26 +497,16 @@ 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) { + // It is not profitable to hoist implicitdefs. FIXME: Why not? what if they + // are an argument to some other otherwise-hoistable instruction? if (I.isImplicitDef()) return false; - - const TargetInstrDesc &TID = I.getDesc(); - // Ignore stuff that we obviously can't hoist. - if (TID.mayStore() || TID.isCall() || TID.isTerminator() || - TID.hasUnmodeledSideEffects()) + // Check if it's safe to move the instruction. + bool DontMoveAcrossStore = true; + if (!I.isSafeToMove(TII, AA, DontMoveAcrossStore)) return false; - - if (TID.mayLoad()) { - // Okay, this instruction does a load. As a refinement, we allow the target - // to decide whether the loaded value is actually a constant. If so, we can - // actually use it as a load. - if (!I.isInvariantLoad(AA)) - // FIXME: we should be able to hoist loads with no other side effects if - // there are no other instructions which can change memory in this loop. - // This is a trivial form of alias analysis. - return false; - } + return true; } |