From d2fe54b33cbfcacb9e563015bc3469455aaf9e87 Mon Sep 17 00:00:00 2001 From: Alan Donovan Date: Fri, 10 Jan 2014 17:10:12 -0500 Subject: [PATCH] go.tools/ssa: fix bug: lifting pass invalidated Referrers info for DebugRef's X operand. Tested: by enabling debug info globally in stdlib_test, the existing sanity checks catch it. R=gri CC=golang-codereviews https://golang.org/cl/50570043 --- ssa/lift.go | 5 +++++ ssa/stdlib_test.go | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ssa/lift.go b/ssa/lift.go index 61198645..f285f2d5 100644 --- a/ssa/lift.go +++ b/ssa/lift.go @@ -523,6 +523,11 @@ func rename(u *BasicBlock, renaming []Value, newPhis newPhiMap) { if instr.IsAddr { instr.X = renamed(renaming, alloc) instr.IsAddr = false + + // Add DebugRef to instr.X's referrers. + if refs := instr.X.Referrers(); refs != nil { + *refs = append(*refs, instr) + } } else { // A source expression denotes the address // of an Alloc that was optimized away. diff --git a/ssa/stdlib_test.go b/ssa/stdlib_test.go index a99ec2f5..ac5bd6fa 100644 --- a/ssa/stdlib_test.go +++ b/ssa/stdlib_test.go @@ -23,7 +23,7 @@ import ( "code.google.com/p/go.tools/ssa/ssautil" ) -const debugMode = false +const debugMode = true // cost: +30% space, +18% time for SSA building func allPackages() []string { var pkgs []string