diff options
| author | Keith Randall <khr@golang.org> | 2023-01-20 13:36:51 -0800 |
|---|---|---|
| committer | Keith Randall <khr@google.com> | 2023-01-21 21:08:00 +0000 |
| commit | 4ff074945a4848cd04c020b7f20ddaa1d78cc548 (patch) | |
| tree | e844dfe4d57cb959131b0f2c25d94e5377adf3d1 /src/cmd/compile | |
| parent | 780fa2426073035459b8a5d8e317f47864132ce4 (diff) | |
| download | go-4ff074945a4848cd04c020b7f20ddaa1d78cc548.tar.xz | |
cmd/compile: sort liveness variable reports
Sort variables before display so that when there are multiple variables
to report, they are in a consistent order.
Otherwise they are ordered in the order they appear in the fn.Dcl list,
which can vary. Particularly, they vary depending on regabi.
Change-Id: I0db380f7cbe6911e87177503a4c3b39851ff1b5a
Reviewed-on: https://go-review.googlesource.com/c/go/+/462898
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Diffstat (limited to 'src/cmd/compile')
| -rw-r--r-- | src/cmd/compile/internal/liveness/plive.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/cmd/compile/internal/liveness/plive.go b/src/cmd/compile/internal/liveness/plive.go index 689b5286c6..e828a6ebb6 100644 --- a/src/cmd/compile/internal/liveness/plive.go +++ b/src/cmd/compile/internal/liveness/plive.go @@ -1106,11 +1106,18 @@ func (lv *liveness) showlive(v *ssa.Value, live bitvec.BitVec) { s += "indirect call:" } + // Sort variable names for display. Variables aren't in any particular order, and + // the order can change by architecture, particularly with differences in regabi. + var names []string for j, n := range lv.vars { if live.Get(int32(j)) { - s += fmt.Sprintf(" %v", n) + names = append(names, n.Sym().Name) } } + sort.Strings(names) + for _, v := range names { + s += " " + v + } base.WarnfAt(pos, s) } |
