[all-commits] [llvm/llvm-project] 333771: [Sema] Avoid isNullPointerConstant invocation

Nick Desaulniers via All-commits all-commits at lists.llvm.org
Sun Aug 14 13:40:18 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 333771f3558c81390a0e5d715ad8d1e419050b66
  Author: Justin Stitt <justinstitt at google.com>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M clang/lib/Sema/SemaChecking.cpp

  Log Message:
  [Sema] Avoid isNullPointerConstant invocation

DiagnoseNullConversion is needlessly calling isNullPointerConstant which
is an expensive routine due to its calls to a constant evaluator --
which we don't need.

Building the Linux Kernel (x86_64) with this fix has improved build
times by ~2.1%. This is mainly due to the following methods no longer
needing to be called anywhere near as often:
1) ExprConstant::CheckICE (reduced CPU cycles by ~90%)
2) IntExprEvaluator::VisitBinaryOperator (reduced CPU cycles by ~50%)

Reviewed By: rtrieu, nickdesaulniers

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

More information about the All-commits mailing list