mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-15 23:57:48 +00:00
Move the check whether it's worth remating to caller.
llvm-svn: 55434
This commit is contained in:
parent
7abe1944ae
commit
cf2cb4da82
@ -714,8 +714,6 @@ bool MachineInstr::isSafeToMove(const TargetInstrInfo *TII, bool &SawStore) {
|
||||
/// isSafeToReMat - Return true if it's safe to rematerialize the specified
|
||||
/// instruction which defined the specified register instead of copying it.
|
||||
bool MachineInstr::isSafeToReMat(const TargetInstrInfo *TII, unsigned DstReg) {
|
||||
if (!TID->isAsCheapAsAMove())
|
||||
return false;
|
||||
bool SawStore = false;
|
||||
if (!isSafeToMove(TII, SawStore))
|
||||
return false;
|
||||
@ -726,7 +724,7 @@ bool MachineInstr::isSafeToReMat(const TargetInstrInfo *TII, unsigned DstReg) {
|
||||
// FIXME: For now, do not remat any instruction with register operands.
|
||||
// Later on, we can loosen the restriction is the register operands have
|
||||
// not been modified between the def and use. Note, this is different from
|
||||
// MachineSink because the code in no longer in two-address form (at least
|
||||
// MachineSink because the code is no longer in two-address form (at least
|
||||
// partially).
|
||||
if (MO.isUse())
|
||||
return false;
|
||||
|
@ -403,6 +403,7 @@ bool TwoAddressInstructionPass::runOnMachineFunction(MachineFunction &MF) {
|
||||
// If it's safe and profitable, remat the definition instead of
|
||||
// copying it.
|
||||
if (DefMI &&
|
||||
DefMI->getDesc().isAsCheapAsAMove() &&
|
||||
DefMI->isSafeToReMat(TII, regB) &&
|
||||
isProfitableToReMat(regB, rc, mi, DefMI, mbbi, Dist,DistanceMap)){
|
||||
DEBUG(cerr << "2addr: REMATTING : " << *DefMI << "\n");
|
||||
|
Loading…
Reference in New Issue
Block a user