[clang][NFC] Optimize clang::ASTNodeKind::isBaseOf
authorPiotr Zegar <me@piotrzegar.pl>
Sat, 6 May 2023 12:04:34 +0000 (12:04 +0000)
committerPiotr Zegar <me@piotrzegar.pl>
Sat, 6 May 2023 12:22:28 +0000 (12:22 +0000)
commitc3d16514d061be30636eca89a8a8a35d06847fe0
tree9efeda13b6081f911b7726e0c912ae3901d1d8f4
parent7e6bcb35a8116a653e4cdf660643e80459c5efce
[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
clang/include/clang/AST/ASTTypeTraits.h
clang/lib/AST/ASTTypeTraits.cpp