[llvm] r287214 - Delete dead code and add asserts instead; NFC

Sanjoy Das via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 16 23:29:44 PST 2016


Author: sanjoy
Date: Thu Nov 17 01:29:43 2016
New Revision: 287214

URL: http://llvm.org/viewvc/llvm-project?rev=287214&view=rev
Log:
Delete dead code and add asserts instead; NFC

Modified:
    llvm/trunk/lib/CodeGen/ImplicitNullChecks.cpp

Modified: llvm/trunk/lib/CodeGen/ImplicitNullChecks.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ImplicitNullChecks.cpp?rev=287214&r1=287213&r2=287214&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/ImplicitNullChecks.cpp (original)
+++ llvm/trunk/lib/CodeGen/ImplicitNullChecks.cpp Thu Nov 17 01:29:43 2016
@@ -266,15 +266,11 @@ bool HazardDetector::isSafeToHoist(Machi
             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




More information about the llvm-commits mailing list