Delete dead code and add asserts instead; NFC
authorSanjoy Das <sanjoy@playingwithpointers.com>
Thu, 17 Nov 2016 07:29:43 +0000 (07:29 +0000)
committerSanjoy Das <sanjoy@playingwithpointers.com>
Thu, 17 Nov 2016 07:29:43 +0000 (07:29 +0000)
llvm-svn: 287214

llvm/lib/CodeGen/ImplicitNullChecks.cpp

index 31d65e6..3caa01e 100644 (file)
@@ -266,15 +266,11 @@ bool HazardDetector::isSafeToHoist(MachineInstr *MI,
             return true;
           if (MO.isUse())
             return false;
-          assert((!MO.isDef() || RegDefs.count(MO.getReg())) &&
+          assert(MO.isDef() &&
+                 "Register MachineOperands must either be uses or be defs.");
+          assert(RegDefs.count(MO.getReg()) &&
                  "All defs must be tracked in RegDefs by now!");
 
-          if (!MO.isDef()) {
-            // FIXME: This is unnecessary, we should be able to
-            // assert(MO.isDef()) here.
-            return true;
-          }
-
           for (unsigned Reg : RegUses)
             if (TRI.regsOverlap(Reg, MO.getReg()))
               return false; // We found a write-after-read