diff options
author | Evan Cheng <evan.cheng@apple.com> | 2010-09-23 06:53:00 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2010-09-23 06:53:00 +0000 |
commit | b0cdf8a4466d02c66c84b6b30953709fa9225a30 (patch) | |
tree | 4d0160d1b5e8c1938d80c893050c61fe340794fb | |
parent | 266a99d161069071f32c7c09dded481fd573a82e (diff) |
Don't sink insert_subreg, subreg_to_reg, reg_sequence. They are meant to be
close to their sources to facilitate coalescing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114631 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/MachineSink.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/CodeGen/MachineSink.cpp b/lib/CodeGen/MachineSink.cpp index 5969c0b345..b9c1eb4b68 100644 --- a/lib/CodeGen/MachineSink.cpp +++ b/lib/CodeGen/MachineSink.cpp @@ -281,7 +281,7 @@ bool MachineSinking::isWorthBreakingCriticalEdge(MachineInstr *MI, 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 @@ MachineBasicBlock *MachineSinking::SplitCriticalEdge(MachineInstr *MI, 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; |