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

r332057 introduced distance() for ranges. Based on post-commit feedback,
this renames distance() to size(). The new size() is also only enabled
when the operation is O(1).

Differential Revision: https://reviews.llvm.org/D46976

llvm-svn: 332551
diff --git a/llvm/lib/IR/Value.cpp b/llvm/lib/IR/Value.cpp
index bdcc657..2f95e93 100644
--- a/llvm/lib/IR/Value.cpp
+++ b/llvm/lib/IR/Value.cpp
@@ -167,7 +167,9 @@
   return false;
 }
 
-unsigned Value::getNumUses() const { return (unsigned)distance(uses()); }
+unsigned Value::getNumUses() const {
+  return (unsigned)std::distance(use_begin(), use_end());
+}
 
 static bool getSymTab(Value *V, ValueSymbolTable *&ST) {
   ST = nullptr;