diff options
author | Evan Cheng <evan.cheng@apple.com> | 2008-08-27 20:58:54 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2008-08-27 20:58:54 +0000 |
commit | 8763c1c54413c9cd0b56e2860edb5856151a69fc (patch) | |
tree | 976c100a2feb2395b6f7e5c5b0a83ad00b509cad | |
parent | 18bb2788a0edc0ec1c373465429743892c8d5fbe (diff) |
Move the check whether it's worth remating to caller.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55434 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/MachineInstr.cpp | 4 | ||||
-rw-r--r-- | lib/CodeGen/TwoAddressInstructionPass.cpp | 1 |
2 files changed, 2 insertions, 3 deletions
diff --git a/lib/CodeGen/MachineInstr.cpp b/lib/CodeGen/MachineInstr.cpp index 966d172bc6..0b1afa3f09 100644 --- a/lib/CodeGen/MachineInstr.cpp +++ b/lib/CodeGen/MachineInstr.cpp @@ -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; diff --git a/lib/CodeGen/TwoAddressInstructionPass.cpp b/lib/CodeGen/TwoAddressInstructionPass.cpp index 5093321c6a..51a3c5f52e 100644 --- a/lib/CodeGen/TwoAddressInstructionPass.cpp +++ b/lib/CodeGen/TwoAddressInstructionPass.cpp @@ -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"); |