go/src/cmd/compile/internal
Yi Yang da4687923b 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: 1aad82e62e
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>
2023-03-20 15:42:09 +00:00
..
abi cmd: fix mismatched symbols 2023-03-07 17:31:14 +00:00
abt all: fix some comments for method 2022-12-03 17:08:51 +00:00
amd64 cmd/compile: batch write barrier calls 2023-02-24 00:21:13 +00:00
arm cmd/compile: batch write barrier calls 2023-02-24 00:21:13 +00:00
arm64 cmd/compile: batch write barrier calls 2023-02-24 00:21:13 +00:00
base cmd/compile: add -url flag, print URL with error messages if applicable 2023-03-16 20:22:11 +00:00
bitvec cmd/compile, runtime: track argument stack slot liveness 2021-10-27 20:27:02 +00:00
compare cmd: fix mismatched symbols 2023-03-07 17:31:14 +00:00
coverage cmd/compile/internal/ir: explicit Pos for New{Bool,Int,String} 2023-03-04 00:00:01 +00:00
deadcode cmd/compile: constant-fold switches early in compilation 2022-04-14 19:37:30 +00:00
devirtualize cmd: remove GOEXPERIMENT=nounified knob 2023-01-25 21:16:32 +00:00
dwarfgen cmd/compile: adjust inlined DW_AT_call_line by //line 2023-02-23 22:08:33 +00:00
escape cmd/compile: pass type checker error codes in the compiler 2023-03-10 18:22:02 +00:00
gc cmd/compile: remove -wrapglobalmapinit flag 2023-03-09 20:09:52 +00:00
importer cmd/compile: replace os.MkdirTemp with T.TempDir 2023-02-06 18:07:35 +00:00
inline cmd/compile: reorder operations in SCCs to enable more inlining 2023-03-09 22:13:26 +00:00
ir cmd/compile: pass type checker error codes in the compiler 2023-03-10 18:22:02 +00:00
liveness cmd/compile: don't mark uintptr->unsafe.Pointer conversion unsafe points 2023-02-28 23:42:44 +00:00
logopt cmd/compile: replace os.MkdirTemp with T.TempDir 2023-02-06 18:07:35 +00:00
loong64 cmd/compile/internal, runtime: use NOOP for hardware NOPs on loong64 2023-03-15 07:18:43 +00:00
loopvar cmd/compile: restore return-in-loop loopvar optimization 2023-03-16 18:46:51 +00:00
mips cmd/compile: batch write barrier calls 2023-02-24 00:21:13 +00:00
mips64 cmd/compile: batch write barrier calls 2023-02-24 00:21:13 +00:00
noder cmd/compile: pass type checker error codes in the compiler 2023-03-10 18:22:02 +00:00
objw cmd/compile/internal: fix a few function names on comments 2022-10-03 17:47:02 +00:00
pgo cmd/compile: report profile open/parse errors 2023-03-09 17:47:01 +00:00
pkginit cmd/compile: pass type checker error codes in the compiler 2023-03-10 18:22:02 +00:00
ppc64 cmd/compile: batch write barrier calls 2023-02-24 00:21:13 +00:00
reflectdata cmd/compile: add flag to FOR/RANGE to preserve loop semantics across inlines 2023-03-06 18:34:53 +00:00
riscv64 cmd/compile: batch write barrier calls 2023-02-24 00:21:13 +00:00
s390x cmd/compile: batch write barrier calls 2023-02-24 00:21:13 +00:00
ssa cmd/compile: add rewrite rules for arithmetic operations 2023-03-20 15:42:09 +00:00
ssagen cmd/compile: instrinsify TrailingZeros{8,32,64} for 386 2023-03-14 08:10:32 +00:00
staticdata cmd/compile: pass type checker error codes in the compiler 2023-03-10 18:22:02 +00:00
staticinit cmd/compile: remove -wrapglobalmapinit flag 2023-03-09 20:09:52 +00:00
syntax cmd/compile/internal/syntax: remove Crawl, not needed anymore (cleanup) 2023-01-17 19:55:04 +00:00
test cmd/compile: rework unbounded shift lowering on PPC64 2023-02-23 22:26:39 +00:00
typebits cmd/compile/internal/typebits: relax alignment check 2022-09-19 13:55:28 +00:00
typecheck cmd/compile: reorder BlankNode assignment to make SetType more clear 2023-03-17 02:25:08 +00:00
types cmd/compile: pass type checker error codes in the compiler 2023-03-10 18:22:02 +00:00
types2 cmd/compile/internal/types2: record error code in Error struct 2023-03-10 17:17:25 +00:00
walk cmd/compile: pass type checker error codes in the compiler 2023-03-10 18:22:02 +00:00
wasm cmd/compile: batch write barrier calls 2023-02-24 00:21:13 +00:00
x86 cmd/compile: instrinsify TrailingZeros{8,32,64} for 386 2023-03-14 08:10:32 +00:00