Xun Li via llvm-dev
2021-Apr-30 16:41 UTC
[llvm-dev] Making lambda function name consistent with GCC?
Hi,
I noticed that when compiling lambda functions, the generated function
names use different conventions than GCC.
Example: https://godbolt.org/z/5qvqKqEe6
The lambda in Clang is named "_Z3barIZ3foovE3$_0EvT_", while the one
in GCC is named "_Z3barIZ3foovEUlvE_EvT_". Their demangled names are
also different ("void bar<foo()::$_0>(foo()::$_0)" vs "void
bar<foo()::{lambda()#1}>(foo()::{lambda()#1})").
Lambdas are not covered by the ABI so this is OK.
However there are use-cases where I find it very inconvenient when
they generate different names. For example, if we are to compare the
performance difference of the same software compiled under Clang and
GCC, the perf stack traces will look very different because of the
naming differences, making it hard to compare.
Is there any particular reason that Clang uses a different naming
convention for lambdas, and would there be push-backs if we were to
make it consistent with GCC?
Thanks.
--
Xun
Tom Stellard via llvm-dev
2021-May-03 18:02 UTC
[llvm-dev] Making lambda function name consistent with GCC?
On 4/30/21 9:41 AM, Xun Li via llvm-dev wrote:> Hi, > > I noticed that when compiling lambda functions, the generated function > names use different conventions than GCC. > Example: https://godbolt.org/z/5qvqKqEe6 > The lambda in Clang is named "_Z3barIZ3foovE3$_0EvT_", while the one > in GCC is named "_Z3barIZ3foovEUlvE_EvT_". Their demangled names are > also different ("void bar<foo()::$_0>(foo()::$_0)" vs "void > bar<foo()::{lambda()#1}>(foo()::{lambda()#1})"). > Lambdas are not covered by the ABI so this is OK. > However there are use-cases where I find it very inconvenient when > they generate different names. For example, if we are to compare the > performance difference of the same software compiled under Clang and > GCC, the perf stack traces will look very different because of the > naming differences, making it hard to compare. > Is there any particular reason that Clang uses a different naming > convention for lambdas, and would there be push-backs if we were to > make it consistent with GCC?Can you file a bug for this? -Tom> Thanks. >