From 542ac629713189bb5b541492b8b95d5061b9a7c0 Mon Sep 17 00:00:00 2001 From: Evan Cheng Date: Sat, 30 Aug 2008 09:07:18 +0000 Subject: [PATCH] Fold isRematerializable checks into isSafeToReMat. llvm-svn: 55563 --- llvm/lib/CodeGen/MachineInstr.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp index 0b1afa3f096e..ce5c5235b824 100644 --- a/llvm/lib/CodeGen/MachineInstr.cpp +++ b/llvm/lib/CodeGen/MachineInstr.cpp @@ -715,7 +715,9 @@ bool MachineInstr::isSafeToMove(const TargetInstrInfo *TII, bool &SawStore) { /// instruction which defined the specified register instead of copying it. bool MachineInstr::isSafeToReMat(const TargetInstrInfo *TII, unsigned DstReg) { bool SawStore = false; - if (!isSafeToMove(TII, SawStore)) + if (!getDesc().isRematerializable() || + !TII->isTriviallyReMaterializable(this) || + !isSafeToMove(TII, SawStore)) return false; for (unsigned i = 0, e = getNumOperands(); i != e; ++i) { MachineOperand &MO = getOperand(i);