[PATCH] D46976: [STLExtras] Add size() for ranges, and remove distance()

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 16 16:06:45 PDT 2018


craig.topper accepted this revision.
craig.topper added a comment.
This revision is now accepted and ready to land.

LGTM



================
Comment at: lib/CodeGen/ImplicitNullChecks.cpp:600
     DefReg = MI->defs().begin()->getReg();
-    assert(distance(MI->defs()) == 1 && "expected exactly one def!");
+    assert(size(MI->defs()) == 1 && "expected exactly one def!");
   }
----------------
Can you just change this to NumDefs == 1? The end for defs() is calculated with MI->getDesc().getNumDefs() which is what NumDefs is assigned to.


https://reviews.llvm.org/D46976





More information about the llvm-commits mailing list