tools/go/analysis/passes
Russ Cox d81a07b7e5 go/analysis/passes/bools: eliminate quadratic runtime, output
If you have x == 1 || x == 2 || x == 3 || x == 4, the pass considered the set

	{x==1, x==2, x==3, x==4}

and then also

	{x==2, x==3, x==4}
	{x==3, x==4}

Since the comparison is itself linear in the size of the set, this was overall
taking time quadratic in the length of the || or && sequence.
Worse, if it found duplicates, they'd be reported a quadratic number of times.

This CL cuts the time and output to linear by avoiding already-checked
subexpressions. This cuts the time spent analyzing cmd/compile/internal/ssa
(with all passes enabled, not just this one) by 20%.

Fixes golang/go#28086.

Change-Id: I812f64bd5a44fea995c9ab0c4fa2fbefb44037ce
Reviewed-on: https://go-review.googlesource.com/c/tools/+/176457
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
2019-05-13 18:47:35 +00:00
..
asmdecl go/analysis/passes: fix bugs discovered in std 2019-05-09 15:32:22 +00:00
assign go/analysis/passes: add doc and copyright comments 2018-10-16 20:28:15 +00:00
atomic go/analysis/passes: add doc and copyright comments 2018-10-16 20:28:15 +00:00
atomicalign Revert "go/analysis/passes/atomicalign: handle pointers to struct" 2019-02-02 20:26:10 +00:00
bools go/analysis/passes/bools: eliminate quadratic runtime, output 2019-05-13 18:47:35 +00:00
buildssa go/analysis/passes/nilness: degenerate nil condition checker 2018-10-19 00:59:45 +00:00
buildtag go/analysis/passes: add doc and copyright comments 2018-10-16 20:28:15 +00:00
cgocall go/{analysis,packages}: add TypesSizes 2019-01-17 19:41:23 +00:00
composite go/analysis/passes/composite: add an example to the doc 2019-01-24 19:20:49 +00:00
copylock go/analysis/passes: add doc and copyright comments 2018-10-16 20:28:15 +00:00
ctrlflow go/analysis/passes: add doc and copyright comments 2018-10-16 20:28:15 +00:00
deepequalerrors go/analysis/passes/deepequalerrors: check for reflect.DeepEqual on errors 2019-02-28 17:43:37 +00:00
errorsas go/analysis/passes: fix bugs discovered in std 2019-05-09 15:32:22 +00:00
findcall go/analysis/cmd/analyze: install all analyzers 2018-10-19 17:03:54 +00:00
httpresponse go/analysis/passes/httpresponse: split out from vet 2018-10-16 19:47:10 +00:00
inspect go/analysis: fix typos and update documentation 2019-01-11 18:03:38 +00:00
internal/analysisutil go/analysis/passes/assign: split out from vet 2018-10-08 20:59:24 +00:00
loopclosure go/analysis/passes: add doc and copyright comments 2018-10-16 20:28:15 +00:00
lostcancel lostcancel: do not analyze cancel variable which defined outside current function scope 2019-05-08 02:57:53 +00:00
nilfunc go/analysis/passes: add doc and copyright comments 2018-10-16 20:28:15 +00:00
nilness go/analysis/passes/nilness: degenerate nil condition checker 2018-10-19 00:59:45 +00:00
pkgfact go/analysis/internal/unitchecker: a 'go vet'-compatible driver 2018-11-02 17:49:05 +00:00
printf cmd/vet: verify potentially-recursive Stringers are actually Stringers 2019-04-25 15:00:28 +00:00
shadow go/analysis/passes/shadow: add shadow command 2018-11-08 22:19:41 +00:00
shift go/{analysis,packages}: add TypesSizes 2019-01-17 19:41:23 +00:00
stdmethods go/analysis/passes: fix bugs discovered in std 2019-05-09 15:32:22 +00:00
structtag go/analysis/passes: fix bugs discovered in std 2019-05-09 15:32:22 +00:00
tests go/analysis/passes/tests: break out of loop when we find a method 2019-03-22 16:28:07 +00:00
unmarshal go/analysis/passes: fix bugs discovered in std 2019-05-09 15:32:22 +00:00
unreachable go/analysis/passes: add doc and copyright comments 2018-10-16 20:28:15 +00:00
unsafeptr go/analysis: unindent some pieces of code 2018-11-19 11:39:21 +00:00
unusedresult go/analysis/passes: add doc and copyright comments 2018-10-16 20:28:15 +00:00
README go/analysis/internal/checker: analysis driver based on go/packages 2018-09-26 01:25:07 +00:00

README

This directory does not contain a Go package,
but acts as a container for various analyses
that implement the golang.org/x/tools/go/analysis
API and may be imported into an analysis tool.

By convention, each package foo provides the analysis,
and each command foo/cmd/foo provides a standalone driver.