From 9a77aa4f083f7458a29c7c13adfe3d2ca8c864ea Mon Sep 17 00:00:00 2001 From: Jorropo Date: Sat, 25 Oct 2025 22:08:59 +0200 Subject: [PATCH] cmd/compile: add position info to sccp debug messages Change-Id: Ic568dd3b2e3ebebb1b6aaa41ee78a12d4e8d3f06 Reviewed-on: https://go-review.googlesource.com/c/go/+/714221 Reviewed-by: Michael Knyszek Auto-Submit: Jorropo Reviewed-by: Keith Randall LUCI-TryBot-Result: Go LUCI Reviewed-by: Keith Randall --- src/cmd/compile/internal/ssa/sccp.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/cmd/compile/internal/ssa/sccp.go b/src/cmd/compile/internal/ssa/sccp.go index 107db23ed4..9b958d0454 100644 --- a/src/cmd/compile/internal/ssa/sccp.go +++ b/src/cmd/compile/internal/ssa/sccp.go @@ -4,10 +4,6 @@ package ssa -import ( - "fmt" -) - // ---------------------------------------------------------------------------- // Sparse Conditional Constant Propagation // @@ -118,7 +114,7 @@ func sccp(f *Func) { constCnt, rewireCnt := t.replaceConst() if f.pass.debug > 0 { if constCnt > 0 || rewireCnt > 0 { - fmt.Printf("Phase SCCP for %v : %v constants, %v dce\n", f.Name, constCnt, rewireCnt) + f.Warnl(f.Entry.Pos, "Phase SCCP for %v : %v constants, %v dce", f.Name, constCnt, rewireCnt) } } } @@ -563,7 +559,7 @@ func (t *worklist) replaceConst() (int, int) { if lt.tag == constant { if !isConst(val) { if t.f.pass.debug > 0 { - fmt.Printf("Replace %v with %v\n", val.LongString(), lt.val.LongString()) + t.f.Warnl(val.Pos, "Replace %v with %v", val.LongString(), lt.val.LongString()) } val.reset(lt.val.Op) val.AuxInt = lt.val.AuxInt @@ -575,7 +571,7 @@ func (t *worklist) replaceConst() (int, int) { if rewireSuccessor(block, lt.val) { rewireCnt++ if t.f.pass.debug > 0 { - fmt.Printf("Rewire %v %v successors\n", block.Kind, block) + t.f.Warnl(block.Pos, "Rewire %v %v successors", block.Kind, block) } } } -- 2.52.0