cmd/compile: a flaw in algebraic simplification rules inside Go compiler #37508
Labels
compiler/runtime
Issues related to the Go compiler and/or runtime.
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Performance
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
What did you expect to see?
I was expecting to see "abc - x + y - z + 948" as the result.
What did you see instead?
So clearly there is a room for improvement in rules of algebraic simplifications of the compiler.
I suggest to add/replace just a few of reassociate rules in the file "https://github.com/golang/go/blob/master/src/cmd/compile/internal/ssa/gen/generic.rules". I made my own set of rules for add/sub combinations which could be used here:
I've tested them with my own compiler tools. Hope you will find them useful!
The text was updated successfully, but these errors were encountered: