An interesting "optimization"? for __glibcxx_assert under verbose mode

unlvsur unlvsur unlvsur@live.com
Fri Oct 15 00:40:52 GMT 2021


This is a better example that can show the benefit
https://godbolt.org/z/aPo95Eb3P

https://godbolt.org/z/Wd4nev8eh


Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows

From: unlvsur unlvsur<mailto:unlvsur@live.com>
Sent: Thursday, October 14, 2021 20:30
To: unlvsur unlvsur via Libstdc++<mailto:libstdc++@gcc.gnu.org>
Subject: An interesting "optimization"? for __glibcxx_assert under verbose mode

I think the parameter can be just embedded in the symbol name of the function. This improves code gen and make optimizers happier under -Os.

But it only works under C++20.

This is a proven concept. It works for both gcc and clang

https://godbolt.org/z/s35s8MTac

https://godbolt.org/z/5KK5PzMEj
Os:
https://godbolt.org/z/4MjGdTajf

https://godbolt.org/z/crfWf41vc
Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows




More information about the Libstdc++ mailing list