[PATCH] D57915: [COFF, ARM64] Remove definitions for _byteswap library functions

Tom Tan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 7 15:31:05 PST 2019

TomTan added a comment.

In D57915#1389788 <https://reviews.llvm.org/D57915#1389788>, @efriedma wrote:

> I did some quick testing with MSVC; apparently it inlines the implementations of these functions when optimizations are on.  We definitely want to support inlining these. Since these are commonly used in performance-sensitive code, I'd prefer to implement the required changes to CodeGenFunction::EmitMSVCBuiltinExpr now, rather than chase after weird performance regressions in the future.
>  ---
> I'm not sure how you could end up with a "duplicate symbols" error from the current implementation, though; these functions are marked "static", so they shouldn't conflict with the real _byteswap_* functions.

It is a great idea to inline these in Clang, could this be tracked for a separate bug? The issue blocks Chromium build for Windows ARM64.

Yes, they are marked as `static inline` in `intrin.h` and are expected to link fine, but there are cases `stdlib.h` is included before including `intrin.h`, the former provides global declaration which seems inherited by the definition in `intrin.h`.



More information about the cfe-commits mailing list