[clang][NFC] Extract the EmitAssemblyHelper::TargetTriple member
authorPavel Samolysov <pavel.samolysov@intel.com>
Mon, 4 Apr 2022 08:23:24 +0000 (11:23 +0300)
committerAlexey Bader <alexey.bader@intel.com>
Mon, 4 Apr 2022 09:16:39 +0000 (12:16 +0300)
commit87b28f5092f2f92fc380f18e8578746bdd2a54b2
tree9fdfd00066eb4a82d682e070493b3d9ec05e3ac3
parent9db1eb13b64b5062e8bc34912c44d5175c26bf78
[clang][NFC] Extract the EmitAssemblyHelper::TargetTriple member

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.

Reviewed By: tejohnson

Differential Revision: https://reviews.llvm.org/D122587
clang/lib/CodeGen/BackendUtil.cpp