[clang] [llvm] [Clang][Lexer] Reland "Detect SSE4.2 availability at runtime in fastParseASCIIIdentifier" (PR #180631)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 8 05:39:37 PDT 2026
Andarwinux wrote:
> > I think llvm/clang as open-source compiler should encourage users who are aware of performance to use more advanced -march.
>
> @Andarwinux Most people do not compile their own version of Clang (and many distros prefer to remain backwards-compatible). The whole point of this PR is to allow the performance gain to all users who support this feature rather than those who put their hands on a -march binary.
Many Linux distributions are also planning to migrate to x86-64-v2/v3, but the main objection we’ve encountered is that “the performance gains aren’t significant enough to justify breaking backward compatibility”
This is a chicken-and-egg problem. Since x86-64-v2 is not the default, software (such as this PR) attempts to add runtime dispatch, which masks the performance benefits of x86-64-v2. Then x86-64-v2 is considered meaningless, which blocks attempts to migrate to it and the possibility of removal of runtime dispatch once adopted as the baseline.
>From the compiler’s perspective, I believe it should encourage downstream users to enable more advanced -march and recompile more frequently - this would be more beneficial for the compiler’s own coverage as well as the code size and performance of compiled binaries. It would benefit the entire ecosystem in long term.
> You can still use -march which should (though MaskRay said otherwise?) not cause any regressions (IIRC the compiler optimizes the whole runtime check away when compiled with SSE4.2 support), so this seems like a net improvement to me.
Yes, that's exactly what I requested in the original PR due to Windows regression.
But I still feel it will open a Pandora’s box. I really don’t want to see a situation decades from now still trapped in the original x86-64 without extensions.
> Ideally, we would use multi-versioning here because that gets the best performance without making people performance tune the compiler when they build. This improves throughput for our pre- and post-commit CI pipeline, debug builds our developers are using, etc.
Could LLVM's infrastructure be upgraded to use -march=x86-64-v2 or native? I'm guessing there aren't any buildbots still running on such old machines.
https://github.com/llvm/llvm-project/pull/180631
More information about the cfe-commits
mailing list