[PATCH] D132330: [ADT] Simplify llvm::bit_cast (NFC)

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 23 11:07:59 PDT 2022


RKSimon added inline comments.


================
Comment at: llvm/include/llvm/ADT/bit.h:34
   std::memcpy(&to, &from, sizeof(To));
   return to;
 }
----------------
kazu wrote:
> RKSimon wrote:
> > Could we use the __builtin_bit_cast if its available?
> > Could we use the __builtin_bit_cast if its available?
> 
> We should be able to.  Would that lead to better code?
> 
That's unlikely although if it allows us to remove the <cstring> we get a reduction in build costs.

MathExtras.h has overtaken <string> as one of the largest include build costs and I've been curious how easily we could reduce this by using ADT/bit.h directly (possibly with more missing c++20 equivalent <bit> methods):

https://commondatastorage.googleapis.com/chromium-browser-clang/llvm-include-analysis.html

I'll continue looking at ways to reduce MathExtras.h use for now - thanks anyway.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132330/new/

https://reviews.llvm.org/D132330



More information about the llvm-commits mailing list