This is an archive of the discontinued LLVM Phabricator instance.

Simplify microsoft mangling of template instantiations
ClosedPublic

Authored by K-ballo on May 31 2014, 5:30 PM.

Details

Summary

Use mangled template instantiation name as key for back references. Templates have their own context for back references, so their mangling is always the same regardless of context. This avoids mangling template instantiations twice.

Diff Detail

Event Timeline

K-ballo updated this revision to Diff 9995.May 31 2014, 5:30 PM
K-ballo retitled this revision from to Simplify microsoft mangling of template instantiations.
K-ballo updated this object.
K-ballo edited the test plan for this revision. (Show Details)
K-ballo added a subscriber: Unknown Object (MLST).
majnemer edited edge metadata.Jun 5 2014, 6:23 PM

Hi,

What's the motivation behind this patch?

timurrrr edited edge metadata.Jun 5 2014, 10:01 PM

Tesr cases?

In D3983#4, @majnemer wrote:

What's the motivation behind this patch?

Efficiency.

I have been profiling the compilation of a heavily templated C++ code, for which name mangling is the dominant part. The Microsoft mangling implementation is about 4 times slower than the Itanium one for this particular case, and it's mainly due to mangling template instantiations twice. As far as I understand, there is no reason to have a back reference key different than the actual mangled name, and thus no reason to mangle template instantiations twice. After this particular change, the Microsoft mangling implementation is just about 2 times slower than the Itanium one.

In D3983#5, @timurrrr wrote:

Tesr cases?

No functionality change is intended by this patch. The test case at /cfe/trunk/test/CodeGenCXX/mangle-ms-back-references-pr13207.cpp should be sufficient.

The change looks good -- it simplifies the code and makes it faster.

David,
Do you have a good way to make sure we don't regress other than commit-and-see-if-it-explodes?

lib/AST/MicrosoftMangle.cpp
678

This variable is no longer used as just a key.
Please use something like TemplateMangling or TDMangling instead?

K-ballo updated this revision to Diff 10180.Jun 6 2014, 8:06 AM
K-ballo edited edge metadata.

Renamed BackReferenceKey to TemplateMangling

K-ballo accepted this revision.Jun 14 2014, 12:21 PM
K-ballo added a reviewer: K-ballo.

Commited in r210416.

This revision is now accepted and ready to land.Jun 14 2014, 12:21 PM
K-ballo closed this revision.Jun 14 2014, 12:22 PM