[Sema] Avoid isNullPointerConstant invocation
authorJustin Stitt <justinstitt@google.com>
Sun, 14 Aug 2022 20:28:49 +0000 (13:28 -0700)
committerNick Desaulniers <ndesaulniers@google.com>
Sun, 14 Aug 2022 20:39:57 +0000 (13:39 -0700)
commit333771f3558c81390a0e5d715ad8d1e419050b66
tree6466307f020ac19a3b6db2832358cce7c9bd4afe
parent0299ebc1bdc9fca176ebcacd590c90dc77a47551
[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
clang/lib/Sema/SemaChecking.cpp