Commit 78c0e1f8 authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder

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 <josharian@gmail.com>
Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 4ae49b59
...@@ -486,7 +486,7 @@ opswitch: ...@@ -486,7 +486,7 @@ opswitch:
OIND, OSPTR, OITAB, OIDATA, OADDR: OIND, OSPTR, OITAB, OIDATA, OADDR:
n.Left = walkexpr(n.Left, init) 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.Left = walkexpr(n.Left, init)
n.Right = walkexpr(n.Right, init) n.Right = walkexpr(n.Right, init)
...@@ -538,15 +538,6 @@ opswitch: ...@@ -538,15 +538,6 @@ opswitch:
n.SetTypecheck(1) 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: case OCOMPLEX:
// Use results from call expression as arguments for complex. // Use results from call expression as arguments for complex.
if n.Left == nil && n.Right == nil { if n.Left == nil && n.Right == nil {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment