Skip to content

cmd/compile: add rewrite rules for arithmetic operations #59111

Closed
@y1yang0

Description

@y1yang0

What version of Go are you using (go version)?

$ go version

Does this issue reproduce with the latest release?

What operating system and processor architecture are you using (go env)?

go env Output
$ go env

What did you do?

Hi, I found that we have a potential local optimization for subtraction involving common integers, which is also implemented in other compilers. i.e. (t + x) - (t + y) ==> x - y. The compiler itself matches such a pattern 303 times after a quick try, it seems that this could be a candidate for generic rules. I'd like to add it if you think it's worth doing. Thanks for your patience.

What did you expect to see?

What did you see instead?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions