Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/compile/internal/ssa: tighten non-faulting loads
This change introduces alias analysis into the ssa backend, and uses it to tighten some loads with their uses. Since stack loads are non-faulting, tighten is now often able to postpone loading function return values until their uses. Given code like res, ok := fn() if !ok { return } // use res The 'res' return value won't be loaded until after examining 'ok.' Fixed golang#19195 Benchmarks on linux/arm: name old time/op new time/op delta BinaryTree17-4 31.1s ± 0% 30.9s ± 0% -0.39% (p=0.001 n=9+8) Fannkuch11-4 13.9s ± 0% 14.1s ± 0% +0.90% (p=0.000 n=8+9) FmtFprintfEmpty-4 666ns ± 5% 674ns ± 4% ~ (p=0.424 n=10+10) FmtFprintfString-4 1.09µs ± 4% 1.12µs ± 4% +2.62% (p=0.027 n=10+10) FmtFprintfInt-4 1.22µs ± 3% 1.16µs ± 3% -4.37% (p=0.000 n=10+10) FmtFprintfIntInt-4 1.74µs ± 2% 1.64µs ± 3% -6.00% (p=0.000 n=10+10) FmtFprintfPrefixedInt-4 1.75µs ± 1% 1.69µs ± 3% -3.80% (p=0.000 n=9+10) FmtFprintfFloat-4 3.27µs ± 1% 3.41µs ± 1% +4.33% (p=0.000 n=10+9) FmtManyArgs-4 6.49µs ± 1% 6.23µs ± 2% -4.10% (p=0.000 n=10+10) GobDecode-4 87.1ms ± 1% 75.5ms ± 1% -13.37% (p=0.000 n=10+10) GobEncode-4 69.4ms ± 1% 69.7ms ± 1% ~ (p=0.190 n=10+10) Gzip-4 3.56s ± 1% 3.57s ± 1% ~ (p=0.053 n=10+9) Gunzip-4 446ms ± 2% 442ms ± 2% ~ (p=0.123 n=10+10) HTTPClientServer-4 1.51ms ± 1% 1.55ms ± 3% +2.26% (p=0.001 n=8+9) JSONEncode-4 191ms ± 1% 175ms ± 2% -8.33% (p=0.000 n=10+10) JSONDecode-4 798ms ± 1% 835ms ± 1% +4.65% (p=0.000 n=10+10) Mandelbrot200-4 33.6ms ± 0% 33.6ms ± 0% ~ (p=0.068 n=8+10) GoParse-4 42.4ms ± 1% 42.5ms ± 1% ~ (p=0.190 n=10+10) RegexpMatchEasy0_32-4 829ns ± 1% 853ns ± 1% +2.98% (p=0.000 n=9+8) RegexpMatchEasy0_1K-4 4.04µs ± 1% 4.03µs ± 1% ~ (p=0.986 n=10+10) RegexpMatchEasy1_32-4 889ns ± 2% 900ns ± 5% ~ (p=0.566 n=10+10) RegexpMatchEasy1_1K-4 6.01µs ± 2% 6.15µs ± 2% +2.29% (p=0.000 n=9+9) RegexpMatchMedium_32-4 1.35µs ± 3% 1.39µs ± 4% +2.26% (p=0.018 n=9+10) RegexpMatchMedium_1K-4 357µs ± 9% 352µs ± 2% ~ (p=0.968 n=10+9) RegexpMatchHard_32-4 22.2µs ± 6% 22.6µs ± 6% ~ (p=0.161 n=9+9) RegexpMatchHard_1K-4 652µs ± 4% 664µs ± 4% +1.91% (p=0.028 n=9+10) Revcomp-4 51.4ms ± 1% 51.3ms ± 2% ~ (p=0.353 n=10+10) Template-4 1.17s ± 2% 1.06s ± 2% -9.39% (p=0.000 n=10+10) TimeParse-4 4.44µs ± 1% 4.46µs ± 1% +0.50% (p=0.003 n=9+10) TimeFormat-4 9.30µs ± 1% 9.33µs ± 1% ~ (p=0.197 n=10+10) [Geo mean] 557µs 553µs -0.82% Change-Id: Ibe35216e1bc3b0ff937cee9b3bac64f40f087b61
- Loading branch information