-
- Downloads
cmd/compile: add rewrite rules for arithmetic operations
Add the following common local transformations (t + x) - (t + y) == x - y (t + x) - (y + t) == x - y (x + t) - (y + t) == x - y (x + t) - (t + y) == x - y (x - t) + (t + y) == x + y (x - t) + (y + t) == x + y The compiler itself matches such patterns many times. This also aligns with other popular compilers. Fixes #59111 Change-Id: Ibdfdb414782f8fcaa20b84ac5d43d0d9ae2c7b60 GitHub-Last-Rev: 1aad82e62e61e89789932c2070851a023f130dd8 GitHub-Pull-Request: golang/go#59119 Reviewed-on: https://go-review.googlesource.com/c/go/+/477555 Reviewed-by:Keith Randall <khr@golang.org> Reviewed-by:
Heschi Kreinick <heschi@google.com> Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by:
Keith Randall <khr@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Keith Randall <khr@golang.org>
Showing
- src/cmd/compile/internal/ssa/_gen/generic.rules 10 additions, 0 deletionssrc/cmd/compile/internal/ssa/_gen/generic.rules
- src/cmd/compile/internal/ssa/rewritegeneric.go 228 additions, 0 deletionssrc/cmd/compile/internal/ssa/rewritegeneric.go
- test/codegen/arithmetic.go 16 additions, 0 deletionstest/codegen/arithmetic.go
Loading
Please register or sign in to comment