This is an archive of the discontinued LLVM Phabricator instance.

[clang][NFC] Extract the EmitAssemblyHelper::TargetTriple member
ClosedPublic

Authored by psamolysov-intel on Mar 28 2022, 8:13 AM.

Details

Summary

Few times in different methods of the EmitAssemblyHelper class the following
code snippet is used to get the TargetTriple and then use it's single method
to check some conditions:

TargetTriple(TheModule->getTargetTriple())

The parsing of a target triple string is not a trivial operation and it takes
time to repeat the parsing many times in different methods of the class and
even numerous times in one method just to call a getter
(llvm::Triple(TheModule->getTargetTriple()).getVendor()), for example.
The patch extracts the TargetTriple member of the EmitAssemblyHelper class to
parse the triple only once in the class' constructor.

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptMar 28 2022, 8:13 AM
Herald added a subscriber: ormris. · View Herald Transcript
psamolysov-intel requested review of this revision.Mar 28 2022, 8:13 AM

I see some code duplication on lines 1056-1065 and 1472-1481, I have a fix for this and going to open a new review after this patch will be landed.

This revision is now accepted and ready to land.Mar 28 2022, 8:56 AM

Thank you @tejohnson for the approve. If there are no objections from someone could you (or another committer) help me with the landing, please?

All tests have been passed. Could anyone with the committer privileges help me with landing, please?