[llvm] r290695 - [IR] Clarify that Value::getName() is not actually cheap.

Justin Lebar via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 28 16:30:42 PST 2016


Author: jlebar
Date: Wed Dec 28 18:30:42 2016
New Revision: 290695

URL: http://llvm.org/viewvc/llvm-project?rev=290695&view=rev
Log:
[IR] Clarify that Value::getName() is not actually cheap.

It involves a hashtable lookup when the Value has a name.

Modified:
    llvm/trunk/include/llvm/IR/Value.h

Modified: llvm/trunk/include/llvm/IR/Value.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Value.h?rev=290695&r1=290694&r2=290695&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/Value.h (original)
+++ llvm/trunk/include/llvm/IR/Value.h Wed Dec 28 18:30:42 2016
@@ -245,8 +245,9 @@ private:
 public:
   /// \brief Return a constant reference to the value's name.
   ///
-  /// This is cheap and guaranteed to return the same reference as long as the
-  /// value is not modified.
+  /// This guaranteed to return the same reference as long as the value is not
+  /// modified.  If the value has a name, this does a hashtable lookup, so it's
+  /// not free.
   StringRef getName() const;
 
   /// \brief Change the name of the value.




More information about the llvm-commits mailing list