cmd/compile: ignore div/mod in prove on non-x86 architectures

Instead of writing AuxInt during prove and then zeroing it during lower,
just don't write it in the first place.

Passes toolstash-check -all.

Change-Id: Iea4b555029a9d69332e835536f9cf3a42b8223db
Reviewed-on: https://go-review.googlesource.com/c/go/+/220682
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
This commit is contained in:
Josh Bleecher Snyder 2020-02-24 13:53:53 -08:00
parent 4ae1879dda
commit 2c859eae1d
11 changed files with 48 additions and 224 deletions

View file

@ -1219,6 +1219,12 @@ func simplifyBlock(sdom SparseTree, ft *factsTable, b *Block) {
case OpDiv16, OpDiv32, OpDiv64, OpMod16, OpMod32, OpMod64:
// On amd64 and 386 fix-up code can be avoided if we know
// the divisor is not -1 or the dividend > MinIntNN.
// Don't modify AuxInt on other architectures,
// as that can interfere with CSE.
// TODO: add other architectures?
if b.Func.Config.arch != "386" && b.Func.Config.arch != "amd64" {
break
}
divr := v.Args[1]
divrLim, divrLimok := ft.limits[divr.ID]
divd := v.Args[0]