]> Cypherpunks.ru repositories - gostls13.git/commit
[dev.ssa] cmd/compile/internal/ssa: remove proven redundant controls.
authorAlexandru Moșoi <mosoi@google.com>
Fri, 19 Feb 2016 11:14:42 +0000 (12:14 +0100)
committerAlexandru Moșoi <alexandru@mosoi.ro>
Sun, 28 Feb 2016 19:48:20 +0000 (19:48 +0000)
commitbdea1d58cfc55a5156c8df392cfc3133589389db
tree59abf2baa9760052fa943f9f624999aaefb85122
parent4e95dfed0197ee6fdf96dc1aa632297a28a1cd95
[dev.ssa] cmd/compile/internal/ssa: remove proven redundant controls.

* It does very simple bounds checking elimination. E.g.
removes the second check in for i := range a { a[i]++; a[i++]; }
* Improves on the following redundant expression:
return a6 || (a6 || (a6 || a4)) || (a6 || (a4 || a6 || (false || a6)))
* Linear in the number of block edges.

I patched in CL 12960 that does bounds, nil and constant propagation
to make sure this CL is not just redundant. Size of pkg/tool/linux_amd64/*
(excluding compile which is affected by this change):

With IsInBounds and IsSliceInBounds
-this -12960 92285080
+this -12960 91947416
-this +12960 91978976
+this +12960 91923088

Gain is ~110% of 12960.

Without IsInBounds and IsSliceInBounds (older run)
-this -12960 95515512
+this -12960 95492536
-this +12960 95216920
+this +12960 95204440

Shaves 22k on its own.

* Can we handle IsInBounds better with this? In
for i := range a { a[i]++; } the bounds checking at a[i]
is not eliminated.

Change-Id: I98957427399145fb33693173fd4d5a8d71c7cc20
Reviewed-on: https://go-review.googlesource.com/19710
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Alexandru Moșoi <alexandru@mosoi.ro>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/cmd/compile/internal/ssa/compile.go
src/cmd/compile/internal/ssa/prove.go [new file with mode: 0644]
test/prove.go [new file with mode: 0644]