From 78c0e1f81d4052f8ca5a50e4e7c5bb35ddec6519 Mon Sep 17 00:00:00 2001 From: Josh Bleecher Snyder Date: Fri, 9 Nov 2018 11:45:04 -0800 Subject: [PATCH] cmd/compile: eliminate dead code During walkexpr, we were assessing whether shifts were bounded. However, that information was dropped on the floor during SSA conversion. The SSA backend already finds all bounded shifts that walkexpr could have, and at negligible extra cost (0.02% in alloc, CPU undetectable). Change-Id: Ieda1af1a2a3ec99bfdc2b0b704c9b80ce8a34486 Reviewed-on: https://go-review.googlesource.com/c/148897 Run-TryBot: Josh Bleecher Snyder Reviewed-by: Matthew Dempsky TryBot-Result: Gobot Gobot --- src/cmd/compile/internal/gc/walk.go | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/cmd/compile/internal/gc/walk.go b/src/cmd/compile/internal/gc/walk.go index fd484a6472..f459cb3dec 100644 --- a/src/cmd/compile/internal/gc/walk.go +++ b/src/cmd/compile/internal/gc/walk.go @@ -486,7 +486,7 @@ opswitch: OIND, OSPTR, OITAB, OIDATA, OADDR: n.Left = walkexpr(n.Left, init) - case OEFACE, OAND, OSUB, OMUL, OADD, OOR, OXOR: + case OEFACE, OAND, OSUB, OMUL, OADD, OOR, OXOR, OLSH, ORSH: n.Left = walkexpr(n.Left, init) n.Right = walkexpr(n.Right, init) @@ -538,15 +538,6 @@ opswitch: n.SetTypecheck(1) } - case OLSH, ORSH: - n.Left = walkexpr(n.Left, init) - n.Right = walkexpr(n.Right, init) - t := n.Left.Type - n.SetBounded(bounded(n.Right, 8*t.Width)) - if Debug['m'] != 0 && n.Bounded() && !Isconst(n.Right, CTINT) { - Warn("shift bounds check elided") - } - case OCOMPLEX: // Use results from call expression as arguments for complex. if n.Left == nil && n.Right == nil { -- 2.50.0