[llvm-commits] [llvm] r114631 - /llvm/trunk/lib/CodeGen/MachineSink.cpp
Evan Cheng
evan.cheng at apple.com
Wed Sep 22 23:53:00 PDT 2010
Author: evancheng
Date: Thu Sep 23 01:53:00 2010
New Revision: 114631
URL: http://llvm.org/viewvc/llvm-project?rev=114631&view=rev
Log:
Don't sink insert_subreg, subreg_to_reg, reg_sequence. They are meant to be
close to their sources to facilitate coalescing.
Modified:
llvm/trunk/lib/CodeGen/MachineSink.cpp
Modified: llvm/trunk/lib/CodeGen/MachineSink.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineSink.cpp?rev=114631&r1=114630&r2=114631&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineSink.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineSink.cpp Thu Sep 23 01:53:00 2010
@@ -281,7 +281,7 @@
if (!CEBCandidates.insert(std::make_pair(From, To)))
return true;
- if (!(MI->isCopyLike() || MI->getDesc().isAsCheapAsAMove()))
+ if (!MI->isCopy() && !MI->getDesc().isAsCheapAsAMove())
return true;
// MI is cheap, we probably don't want to break the critical edge for it.
@@ -368,9 +368,18 @@
return FromBB->SplitCriticalEdge(ToBB, this);
}
+static bool AvoidsSinking(MachineInstr *MI, MachineRegisterInfo *MRI) {
+ return MI->isInsertSubreg() || MI->isSubregToReg() || MI->isRegSequence();
+}
+
/// SinkInstruction - Determine whether it is safe to sink the specified machine
/// instruction out of its current block into a successor.
bool MachineSinking::SinkInstruction(MachineInstr *MI, bool &SawStore) {
+ // Don't sink insert_subreg, subreg_to_reg, reg_sequence. These are meant to
+ // be close to the source to make it easier to coalesce.
+ if (AvoidsSinking(MI, MRI))
+ return false;
+
// Check if it's safe to move the instruction.
if (!MI->isSafeToMove(TII, AA, SawStore))
return false;
More information about the llvm-commits
mailing list