]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: don't do floating point optimization x+0 -> x
authorKeith Randall <khr@google.com>
Mon, 17 Sep 2018 21:46:07 +0000 (14:46 -0700)
committerKeith Randall <khr@golang.org>
Tue, 18 Sep 2018 20:27:09 +0000 (20:27 +0000)
commitc6118af55864916c2c3b1bca8e216e627f232bf3
treee0e07413df13dbaf1a6624b6724ad79c3a867771
parent83dfc3b001245f0b725afdc94c0b540fe1952d21
cmd/compile: don't do floating point optimization x+0 -> x

That optimization is not valid if x == -0.

The test is a bit tricky because 0 == -0. We distinguish
0 from -0 with 1/0 == inf, 1/-0 == -inf.

This has been a bug since CL 24790 in Go 1.8. Probably doesn't
warrant a backport.

Fixes #27718

Note: the optimization x-0 -> x is actually valid.
But it's probably best to take it out, so as to not confuse readers.

Change-Id: I99f16a93b45f7406ec8053c2dc759a13eba035fa
Reviewed-on: https://go-review.googlesource.com/135701
Reviewed-by: Cherry Zhang <cherryyz@google.com>
src/cmd/compile/internal/ssa/gen/generic.rules
src/cmd/compile/internal/ssa/rewritegeneric.go
test/fixedbugs/issue27718.go [new file with mode: 0644]