Print variable's display name in dwarf DIE.
[oota-llvm.git] / lib / CodeGen / MachineSink.cpp
index 87114396f9e5fcb8c8f12fa6327ee6a3fe7a685f..468bd01548c244dacfaa675c275d4116941cb90c 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
@@ -208,6 +212,11 @@ bool MachineSinking::SinkInstruction(MachineInstr *MI, bool &SawStore) {
   // If there are no outputs, it must have side-effects.
   if (SuccToSinkTo == 0)
     return false;
+
+  // It's not safe to sink instructions to EH landing pad. Control flow into
+  // landing pad is implicitly defined.
+  if (SuccToSinkTo->isLandingPad())
+    return false;
   
   DEBUG(cerr << "Sink instr " << *MI);
   DEBUG(cerr << "to block " << *SuccToSinkTo);