[all-commits] [llvm/llvm-project] 03a0bf: [clang][dataflow] Add an early-out to `flowConditi...
martinboehme via All-commits
all-commits at lists.llvm.org
Tue Jan 9 10:19:08 PST 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 03a0bfa96a6eb09c4bbae344ac3aa062339aa730
https://github.com/llvm/llvm-project/commit/03a0bfa96a6eb09c4bbae344ac3aa062339aa730
Author: martinboehme <mboehme at google.com>
Date: 2024-01-09 (Tue, 09 Jan 2024)
Changed paths:
M clang/include/clang/Analysis/FlowSensitive/Formula.h
M clang/lib/Analysis/FlowSensitive/DataflowAnalysisContext.cpp
Log Message:
-----------
[clang][dataflow] Add an early-out to `flowConditionImplies()` / `flowConditionAllows()`. (#77453)
This saves having to assemble the set of constraints and run the SAT
solver in
the trivial case where `F` is true.
This is a performance win on the benchmarks for the Crubit nullability
checker:
```
name old cpu/op new cpu/op delta
BM_PointerAnalysisCopyPointer 64.1µs ± 5% 63.1µs ± 0% -1.56% (p=0.000 n=20+17)
BM_PointerAnalysisIntLoop 172µs ± 2% 171µs ± 0% ~ (p=0.752 n=20+17)
BM_PointerAnalysisPointerLoop 408µs ± 3% 355µs ± 0% -12.99% (p=0.000 n=20+17)
BM_PointerAnalysisBranch 201µs ± 2% 184µs ± 0% -8.28% (p=0.000 n=20+19)
BM_PointerAnalysisLoopAndBranch 684µs ± 2% 613µs ± 2% -10.38% (p=0.000 n=20+19)
BM_PointerAnalysisTwoLoops 309µs ± 2% 308µs ± 2% ~ (p=0.728 n=20+19)
BM_PointerAnalysisJoinFilePath 37.9ms ± 2% 37.9ms ± 2% +0.06% (p=0.041 n=20+19)
BM_PointerAnalysisCallInLoop 26.5ms ± 2% 26.4ms ± 4% -0.59% (p=0.024 n=20+20)
```
When running clang-tidy on real-world code, the results are less clear.
In
three runs, averaged, on an arbitrarily chosen input file, I get 11.91 s
of user
time without this patch and 11.81 s with it, though with considerable
measurement noise (I'm seeing up to 0.2 s of variation between runs).
Still, this is a very simple change, and it is a clear win in
benchmarks, so I
think it is worth making.
More information about the All-commits
mailing list