[all-commits] [llvm/llvm-project] 87b28f: [clang][NFC] Extract the EmitAssemblyHelper::Targe...

Pavel Samolysov via All-commits all-commits at lists.llvm.org
Mon Apr 4 05:16:55 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 87b28f5092f2f92fc380f18e8578746bdd2a54b2
      https://github.com/llvm/llvm-project/commit/87b28f5092f2f92fc380f18e8578746bdd2a54b2
  Author: Pavel Samolysov <pavel.samolysov at intel.com>
  Date:   2022-04-04 (Mon, 04 Apr 2022)

  Changed paths:
    M clang/lib/CodeGen/BackendUtil.cpp

  Log Message:
  -----------
  [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




More information about the All-commits mailing list