Fold isRematerializable checks into isSafeToReMat.
authorEvan Cheng <evan.cheng@apple.com>
Sat, 30 Aug 2008 09:07:18 +0000 (09:07 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Sat, 30 Aug 2008 09:07:18 +0000 (09:07 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55563 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/MachineInstr.cpp

index 0b1afa3f096ef34da9d014239f086c375f3fcd89..ce5c5235b8247300cea1afaf2b0117f7c6af8476 100644 (file)
@@ -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);