aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/ssa/critical.go
AgeCommit message (Collapse)Author
2017-03-17cmd/compile: move Frontend field from ssa.Config to ssa.FuncJosh Bleecher Snyder
Suggested by mdempsky in CL 38232. This allows us to use the Frontend field to associate frontend state and information with a function. See the following CL in the series for examples. This is a giant CL, but it is almost entirely routine refactoring. The ssa test API is starting to feel a bit unwieldy. I will clean it up separately, once the dust has settled. Passes toolstash -cmp. Updates #15756 Change-Id: I71c573bd96ff7251935fce1391b06b1f133c3caf Reviewed-on: https://go-review.googlesource.com/38327 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-12-08[dev.inline] cmd/compile/internal/ssa: rename various fields from Line to PosRobert Griesemer
This is a mostly mechanical rename followed by manual fixes where necessary. Change-Id: Ie5c670b133db978f15dc03e50dc2da0c80fc8842 Reviewed-on: https://go-review.googlesource.com/34137 Reviewed-by: David Lazar <lazard@golang.org>
2016-05-05cmd/compile: enable constant-time CFG editingKeith Randall
Provide indexes along with block pointers for Preds and Succs arrays. This allows us to splice edges in and out of those arrays in constant time. Fixes worst-case O(n^2) behavior in deadcode and fuse. benchmark old ns/op new ns/op delta BenchmarkFuse1-8 2065 2057 -0.39% BenchmarkFuse10-8 9408 9073 -3.56% BenchmarkFuse100-8 105238 76277 -27.52% BenchmarkFuse1000-8 3982562 1026750 -74.22% BenchmarkFuse10000-8 301220329 12824005 -95.74% BenchmarkDeadCode1-8 1588 1566 -1.39% BenchmarkDeadCode10-8 4333 4250 -1.92% BenchmarkDeadCode100-8 32031 32574 +1.70% BenchmarkDeadCode1000-8 590407 468275 -20.69% BenchmarkDeadCode10000-8 17822890 5000818 -71.94% BenchmarkDeadCode100000-8 1388706640 78021127 -94.38% BenchmarkDeadCode200000-8 5372518479 168598762 -96.86% Change-Id: Iccabdbb9343fd1c921ba07bbf673330a1c36ee17 Reviewed-on: https://go-review.googlesource.com/22589 Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com> Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-18cmd/compile: perform minimal phi elimination during criticalTodd Neal
Phi splitting sometimes leads to a phi with only a single predecessor. This must be replaced with a copy to maintain a valid SSA form. Fixes #14857 Change-Id: I5ab2423fb6c85a061928e3206b02185ea8c79cd7 Reviewed-on: https://go-review.googlesource.com/20826 Reviewed-by: Keith Randall <khr@golang.org>
2016-03-17cmd/compile: correct maintain use count when phi args mergeDavid Chase
The critical phase did not correctly maintain the use count when two predecessors of a new critical block transmit the same value. Change-Id: Iba802c98ebb84e36a410721ec32c867140efb6d4 Reviewed-on: https://go-review.googlesource.com/20822 Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Todd Neal <todd@tneal.org>
2016-03-17cmd/compile: reuse blocks in critical passTodd Neal
If a phi has duplicate arguments, then the new block that is constructed to remove the critical edge can be used for all of the duplicate arguments. read-only data = -904 bytes (-0.058308%) global text (code) = -2240 bytes (-0.060056%) Total difference -3144 bytes (-0.056218%) Change-Id: Iee3762744d6a8c9d26cdfa880bb23feb62b03c9c Reviewed-on: https://go-review.googlesource.com/20746 Run-TryBot: Todd Neal <todd@tneal.org> Reviewed-by: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-15cmd/compile: add logging to critical and phielimTodd Neal
Change-Id: Ieefeceea40bd29657fd519368b0920dad8443844 Reviewed-on: https://go-review.googlesource.com/20712 Run-TryBot: Todd Neal <todd@tneal.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
2016-02-24[dev.ssa] cmd/compile: leave JMPs in when using -NKeith Randall
Helps keep line numbers around for debugging, particularly for break and continue statements (which often compile down to nothing). Update #14379 Change-Id: I6ea06aa887b0450d9ba4f11e319e5c263f5a98ba Reviewed-on: https://go-review.googlesource.com/19848 Reviewed-by: David Chase <drchase@google.com>
2015-09-11[dev.ssa] cmd/compile/internal/ssa: simplify how exit blocks are usedKeith Randall
Move to implicit (mostly) instead of explicit exit blocks. RET and RETJMP have no outgoing edges - they implicitly exit. CALL only has one outgoing edge, as its exception edge is implicit as well. Exit blocks are only used for unconditionally panicking code, like the failed branches of nil and bounds checks. There may now be more than one exit block. No merges happen at exit blocks. The only downside is it is harder to find all the places code can exit the method. See the reverse dominator code for an example. Change-Id: I42e2fd809a4bf81301ab993e29ad9f203ce48eb0 Reviewed-on: https://go-review.googlesource.com/14462 Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-09-03[dev.ssa] cmd/compile/internal/ssa: distinguish exit and return blocksKeith Randall
It is confusing to have exceptional edges jump back into real code. Distinguish return blocks, which execute acutal code, and the exit block, which is a merge point for the regular and exceptional return flow. Prevent critical edge insertion from adding blocks on edges into the exit block. These added blocks serve no purpose and add a bunch of dead jumps to the assembly output. Furthermore, live variable analysis is confused by these jumps. Change-Id: Ifd69e6c00e90338ed147e7cb351b5100dc0364df Reviewed-on: https://go-review.googlesource.com/14254 Reviewed-by: David Chase <drchase@google.com>
2015-08-25[dev.ssa] cmd/compile/internal/ssa: add more critical edgesKeith Randall
Add blocks to remove critical edges, even when it looks like there's no phi that requires it. Regalloc still likes to have critical-edge-free graphs for other reasons. Change-Id: I69f8eaecbc5d79ab9f2a257c2e289d60b18e43c8 Reviewed-on: https://go-review.googlesource.com/13933 Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-05-28[dev.ssa] Merge remote-tracking branch 'origin/master' into mergebranchKeith Randall
Semi-regular merge of tip to dev.ssa. Complicated a bit by the move of cmd/internal/* to cmd/compile/internal/*. Change-Id: I1c66d3c29bb95cce4a53c5a3476373aa5245303d