[PATCH] D22949: Speed up Function::isIntrinsic() by adding a bit to GlobalValue. NFC

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 28 16:07:24 PST 2016


rnk added a comment.

Also, this comment in Value.h could use an update:

  /// \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.
  StringRef getName() const;

A hash table lookup is only cheap in grad school.



================
Comment at: llvm/trunk/include/llvm/IR/GlobalValue.h:145
+  /// Function::intrinsicID() returns Intrinsic::not_intrinsic.
+  bool HasLLVMReservedName : 1;
 
----------------
Please use `unsigned` so this doesn't grow Value on Windows. This program compiles without error with MSVC:
  enum IntrinsicID : unsigned { ID0 = 0 };
  struct Foo { IntrinsicID id : 31; bool bit : 1; };
  struct Bar { IntrinsicID id : 31; unsigned bit : 1; };
  static_assert(sizeof(Foo) == 8, "");
  static_assert(sizeof(Bar) == 4, "");




Repository:
  rL LLVM

https://reviews.llvm.org/D22949





More information about the llvm-commits mailing list