[all-commits] [llvm/llvm-project] c3d165: [clang][NFC] Optimize clang::ASTNodeKind::isBaseOf

Piotr Zegar via All-commits all-commits at lists.llvm.org
Sat May 6 05:22:46 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c3d16514d061be30636eca89a8a8a35d06847fe0
      https://github.com/llvm/llvm-project/commit/c3d16514d061be30636eca89a8a8a35d06847fe0
  Author: Piotr Zegar <me at piotrzegar.pl>
  Date:   2023-05-06 (Sat, 06 May 2023)

  Changed paths:
    M clang/include/clang/AST/ASTTypeTraits.h
    M clang/lib/AST/ASTTypeTraits.cpp

  Log Message:
  -----------
  [clang][NFC] Optimize clang::ASTNodeKind::isBaseOf

Create dedicated isBaseOf method without calculating
distance.

Tested on RISCVISelDAGToDAG.cpp with:
clang-tidy --checks=*,-bugprone-unchecked-optional-access

Amount of CPU cycles for isBaseOf reduced by ~15% (according to perf).

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D149518




More information about the All-commits mailing list