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

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


Thanks, Reid.  I sent D28149 to address the packing issue.  When I
commit that, I'll also commit a comment change to Value.h.

On Wed, Dec 28, 2016 at 4:07 PM, Reid Kleckner via Phabricator
<reviews at reviews.llvm.org> wrote:
> 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