Don't sink the instruction if TargetRegisterInfo::isSafeToMoveRegClassDefs doesn...
authorEvan Cheng <evan.cheng@apple.com>
Sat, 7 Feb 2009 01:21:47 +0000 (01:21 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Sat, 7 Feb 2009 01:21:47 +0000 (01:21 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63994 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/MachineSink.cpp

index 87114396f9e5fcb8c8f12fa6327ee6a3fe7a685f..a85a41fbaee8d92c9bc1b3656f36d2a7aa86071b 100644 (file)
@@ -167,6 +167,10 @@ bool MachineSinking::SinkInstruction(MachineInstr *MI, bool &SawStore) {
     } else {
       // Virtual register uses are always safe to sink.
       if (MO.isUse()) continue;
+
+      // If it's not safe to move defs of the register class, then abort.
+      if (!TII->isSafeToMoveRegClassDefs(RegInfo->getRegClass(Reg)))
+        return false;
       
       // FIXME: This picks a successor to sink into based on having one
       // successor that dominates all the uses.  However, there are cases where