]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: restrict bit test rewrite rules
authorKeith Randall <khr@golang.org>
Mon, 4 May 2020 16:50:20 +0000 (09:50 -0700)
committerKeith Randall <khr@golang.org>
Tue, 5 May 2020 15:41:37 +0000 (15:41 +0000)
commitb4ecafc986268d171776603537d40c8dff3fae61
treeaa94738242e4826690adbceefab68683a251d98d
parent9b189686a53d7fec7deb93d7521531157aa023cb
cmd/compile: restrict bit test rewrite rules

The {AND,OR,XOR}const ops can only take an int32 as an argument.
Make sure that when rewriting a BTx op to one of these, the result
has no high-order bits.

Fixes #38746

Change-Id: Ia7c5f76952329f60974bc033c29a5433610f3b28
Reviewed-on: https://go-review.googlesource.com/c/go/+/231977
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
src/cmd/compile/internal/ssa/gen/AMD64.rules
src/cmd/compile/internal/ssa/rewriteAMD64.go
test/fixedbugs/issue38746.go [new file with mode: 0644]