summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2008-08-27 20:58:54 +0000
committerEvan Cheng <evan.cheng@apple.com>2008-08-27 20:58:54 +0000
commitf016b263e24596306932e8a5b1ede4d486595c1a (patch)
treed098de8fa488077c33560ecb1587b7f7a1ca4ded /llvm/lib/CodeGen
parentd6adbb6a0f4ca6a2713cac5cac45e8c3ca2205bb (diff)
downloadbcm5719-llvm-f016b263e24596306932e8a5b1ede4d486595c1a.tar.gz
bcm5719-llvm-f016b263e24596306932e8a5b1ede4d486595c1a.zip
Move the check whether it's worth remating to caller.
llvm-svn: 55434
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/MachineInstr.cpp4
-rw-r--r--llvm/lib/CodeGen/TwoAddressInstructionPass.cpp1
2 files changed, 2 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp
index 966d172bc61..0b1afa3f096 100644
--- a/llvm/lib/CodeGen/MachineInstr.cpp
+++ b/llvm/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/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp b/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
index 5093321c6af..51a3c5f52ed 100644
--- a/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
+++ b/llvm/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");
OpenPOWER on IntegriCloud