- 11 Aug, 2015 4 commits
-
-
Josh Bleecher Snyder authored
Introduce pseudo-ops PanicMem and LoweredPanicMem. PanicMem could be rewritten directly into MOVL during lowering, but then we couldn't log nil checks. With this change, runnable nil check tests pass: GOSSAPKG=main go run run.go -- nil*.go Compiler output nil check tests fail: GOSSAPKG=p go run run.go -- nil*.go This is due to several factors: * SSA has improved elimination of unnecessary nil checks. * SSA is missing elimination of implicit nil checks. * SSA is missing extra logging about why nil checks were removed. I'm not sure how best to resolve these failures, particularly in a world in which the two backends will live side by side for some time. For now, punt on the problem. Change-Id: Ib2ca6824551671f92e0e1800b036f5ca0905e2a3 Reviewed-on: https://go-review.googlesource.com/13474Reviewed-by: Keith Randall <khr@golang.org>
-
Josh Bleecher Snyder authored
We were not recording function calls as changing the state of memory. As a result, the scheduler was not aware that storing values to the stack in order to make a function call must happen *after* retrieving results from the stack from a just-completed function call. This fixes the container/ring tests. This was my first experience debugging an issue using the HTML output. I'm feeling quite pleased with it. Change-Id: I9e8276846be9fd7a60422911b11816c5175e3d0a Reviewed-on: https://go-review.googlesource.com/13560Reviewed-by: Keith Randall <khr@golang.org>
-
David Chase authored
Hardcoded the limit on constants only allowed. Change-Id: Idb9b07b4871db7a752a79e492671e9b41207b956 Reviewed-on: https://go-review.googlesource.com/13257Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
-
Todd Neal authored
Move the known-non-nil scan outside the work loop to resolve an issue with values that were declared outside the block being operated on. Also consider phis whose arguments are all non-nil, as non-nil. Change-Id: I4d5b840042de9eb181f2cb918f36913fb5d517a2 Reviewed-on: https://go-review.googlesource.com/13441Reviewed-by: Keith Randall <khr@golang.org>
-
- 10 Aug, 2015 3 commits
-
-
Keith Randall authored
Change-Id: Ibcd4c6984c8728fd9ab76e0c7df555984deaf281 Reviewed-on: https://go-review.googlesource.com/13471Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
-
Josh Bleecher Snyder authored
Use a version of Floyd's cycle finding algorithm, but advance by 1 and 1/2 steps per cycle rather than by 1 and 2. It is simpler and should be cheaper in the normal, acyclic case. This should fix the 386 and arm builds, which are currently hung. Change-Id: If8bd443011b28a5ecb004a549239991d3dfc862b Reviewed-on: https://go-review.googlesource.com/13473Reviewed-by: Keith Randall <khr@golang.org>
-
Keith Randall authored
We must make sure that all loads that use a store are scheduled before the next store. Add additional dependency edges to the value graph to enforce this constraint. Change-Id: Iab83644f68bc4c30637085b82ca7467b9d5513a5 Reviewed-on: https://go-review.googlesource.com/13470Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
-
- 07 Aug, 2015 1 commit
-
-
Josh Bleecher Snyder authored
Change-Id: Ia946c259628f84dc7031171456563975d2ad5ea9 Reviewed-on: https://go-review.googlesource.com/13381Reviewed-by: Keith Randall <khr@golang.org>
-
- 06 Aug, 2015 12 commits
-
-
Todd Neal authored
Don't nilcheck values that were constructed as a result of OpAddr or OpAddPtr. Change-Id: I38053e905d1b76a2a64e77f84e444d38a5217108 Reviewed-on: https://go-review.googlesource.com/13256Reviewed-by: David Chase <drchase@google.com>
-
Josh Bleecher Snyder authored
Rather than require an explicit Copy on the RHS of rewrite rules, use rulegen magic to add it. The advantages to handling this in rulegen are: * simpler rules * harder to accidentally miss a Copy Change-Id: I46853bade83bdf517eee9495bf5a553175277b53 Reviewed-on: https://go-review.googlesource.com/13242Reviewed-by: Keith Randall <khr@golang.org>
-
Alexandru Moșoi authored
The lowering rules were missing the non-64 bit case. SBBLcarrymask can be folded to a int32 integer whose type has a smaller bit size. Without the new AND rules the following would be generated: v19 = MOVLconst <uint8> [-1] : SI v20 = ANDB <uint8> v18 v19 : DI which is obviously a NOP. Fixes #12022 Change-Id: I5f4209f78edc0f118e5b9b2908739f09cefebca4 Reviewed-on: https://go-review.googlesource.com/13301Reviewed-by: Keith Randall <khr@golang.org>
-
Josh Bleecher Snyder authored
Tests courtesy of Todd Neal. Change-Id: If657c7c7d3cd1ce01e9d9ad79eb6b2110230c0f9 Reviewed-on: https://go-review.googlesource.com/13267Reviewed-by: Todd Neal <todd@tneal.org> Reviewed-by: Keith Randall <khr@golang.org>
-
Keith Randall authored
Make sure all referenced Blocks and Values are really there. Fix deadcode to generate SSA graphs that pass this new test. Change-Id: Ib002ce20e33490eb8c919bd189d209f769d61517 Reviewed-on: https://go-review.googlesource.com/13147Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
-
Josh Bleecher Snyder authored
Change-Id: I035708f5d0659b3deef00808d35e1cc8a80215e0 Reviewed-on: https://go-review.googlesource.com/13243Reviewed-by: Keith Randall <khr@golang.org>
-
Josh Bleecher Snyder authored
Change-Id: I684440dc316625d5572cc12179adbc206e306429 Reviewed-on: https://go-review.googlesource.com/13263Reviewed-by: Keith Randall <khr@golang.org>
-
Josh Bleecher Snyder authored
No functional changes. The intent is just to make this easier to read and maintain. Change-Id: Iec207546482cd62bcb22eaae8efe5be6c4f15378 Reviewed-on: https://go-review.googlesource.com/13284Reviewed-by: Keith Randall <khr@golang.org>
-
Josh Bleecher Snyder authored
Change-Id: I402841743fcdc287631646039eb149f5cfdf886c Reviewed-on: https://go-review.googlesource.com/13269Reviewed-by: Keith Randall <khr@golang.org>
-
Josh Bleecher Snyder authored
regalloc expects to find all OpSP and OpSB values in the entry block. There is no value to moving them; don't. Change-Id: I775198f03ce7420348721ffc5e7d2bab065465b1 Reviewed-on: https://go-review.googlesource.com/13266Reviewed-by: Keith Randall <khr@golang.org>
-
Josh Bleecher Snyder authored
Change-Id: I2667b0923e17df7cbf08e34ebec1b69a0f2f02b2 Reviewed-on: https://go-review.googlesource.com/13265Reviewed-by: Keith Randall <khr@golang.org>
-
Josh Bleecher Snyder authored
Given (say) b1: <- b2 b3 v1 = Phi <t> v2 v3 b2: v2 = ... b3: ... tighten will move v2 to b1, since it is only used in b1. This is wrong; v2 needs to be evaluated before entering b1. Fix it. Change-Id: I2cc3b30e3ffd221cf594e36cec534dfd9cf3c6a7 Reviewed-on: https://go-review.googlesource.com/13264Reviewed-by: Keith Randall <khr@golang.org>
-
- 05 Aug, 2015 1 commit
-
-
Josh Bleecher Snyder authored
Even this very simple, restricted initial implementation helps. While running make.bash, it moves 84437 values to new, closer homes. As a concrete example: func f_ssa(i, j int, b bool) int { if !b { return 0 } return i + j } It cuts off one stack slot and two instructions: Before: "".f_ssa t=1 size=96 value=0 args=0x20 locals=0x18 0x0000 00000 (x.go:3) TEXT "".f_ssa(SB), $24-32 0x0000 00000 (x.go:3) SUBQ $24, SP 0x0004 00004 (x.go:3) FUNCDATA $0, "".gcargs·0(SB) 0x0004 00004 (x.go:3) FUNCDATA $1, "".gclocals·1(SB) 0x0004 00004 (x.go:5) MOVQ $0, AX 0x0006 00006 (x.go:3) MOVQ 32(SP), CX 0x000b 00011 (x.go:3) MOVQ 40(SP), DX 0x0010 00016 (x.go:3) LEAQ 48(SP), BX 0x0015 00021 (x.go:3) MOVB (BX), BPB 0x0018 00024 (x.go:3) MOVQ $0, SI 0x001a 00026 (x.go:3) MOVQ SI, 56(SP) 0x001f 00031 (x.go:3) TESTB BPB, BPB 0x0022 00034 (x.go:5) MOVQ AX, (SP) 0x0026 00038 (x.go:3) MOVQ CX, 8(SP) 0x002b 00043 (x.go:3) MOVQ DX, 16(SP) 0x0030 00048 (x.go:4) JEQ 74 0x0032 00050 (x.go:3) MOVQ 8(SP), AX 0x0037 00055 (x.go:3) MOVQ 16(SP), CX 0x003c 00060 (x.go:7) LEAQ (AX)(CX*1), DX 0x0040 00064 (x.go:7) MOVQ DX, 56(SP) 0x0045 00069 (x.go:3) ADDQ $24, SP 0x0049 00073 (x.go:3) RET 0x004a 00074 (x.go:5) MOVQ (SP), AX 0x004e 00078 (x.go:5) MOVQ AX, 56(SP) 0x0053 00083 (x.go:3) JMP 69 After: "".f_ssa t=1 size=80 value=0 args=0x20 locals=0x10 0x0000 00000 (x.go:3) TEXT "".f_ssa(SB), $16-32 0x0000 00000 (x.go:3) SUBQ $16, SP 0x0004 00004 (x.go:3) FUNCDATA $0, "".gcargs·0(SB) 0x0004 00004 (x.go:3) FUNCDATA $1, "".gclocals·1(SB) 0x0004 00004 (x.go:3) MOVQ 32(SP), AX 0x0009 00009 (x.go:3) MOVQ 24(SP), CX 0x000e 00014 (x.go:3) LEAQ 40(SP), DX 0x0013 00019 (x.go:3) MOVB (DX), BL 0x0015 00021 (x.go:3) MOVQ $0, BP 0x0017 00023 (x.go:3) MOVQ BP, 48(SP) 0x001c 00028 (x.go:3) TESTB BL, BL 0x001e 00030 (x.go:3) MOVQ AX, (SP) 0x0022 00034 (x.go:3) MOVQ CX, 8(SP) 0x0027 00039 (x.go:4) JEQ 64 0x0029 00041 (x.go:3) MOVQ 8(SP), AX 0x002e 00046 (x.go:3) MOVQ (SP), CX 0x0032 00050 (x.go:7) LEAQ (AX)(CX*1), DX 0x0036 00054 (x.go:7) MOVQ DX, 48(SP) 0x003b 00059 (x.go:3) ADDQ $16, SP 0x003f 00063 (x.go:3) RET 0x0040 00064 (x.go:5) MOVQ $0, AX 0x0042 00066 (x.go:5) MOVQ AX, 48(SP) 0x0047 00071 (x.go:3) JMP 59 Of course, the old backend is still well ahead: "".f_ssa t=1 size=48 value=0 args=0x20 locals=0x0 0x0000 00000 (x.go:3) TEXT "".f_ssa(SB), $0-32 0x0000 00000 (x.go:3) NOP 0x0000 00000 (x.go:3) NOP 0x0000 00000 (x.go:3) FUNCDATA $0, gclocals·a8eabfc4a4514ed6b3b0c61e9680e440(SB) 0x0000 00000 (x.go:3) FUNCDATA $1, gclocals·33cdeccccebe80329f1fdbee7f5874cb(SB) 0x0000 00000 (x.go:4) CMPB "".b+24(FP), $0 0x0005 00005 (x.go:4) JNE 17 0x0007 00007 (x.go:5) MOVQ $0, "".~r3+32(FP) 0x0010 00016 (x.go:5) RET 0x0011 00017 (x.go:7) MOVQ "".i+8(FP), BX 0x0016 00022 (x.go:7) MOVQ "".j+16(FP), BP 0x001b 00027 (x.go:7) ADDQ BP, BX 0x001e 00030 (x.go:7) MOVQ BX, "".~r3+32(FP) 0x0023 00035 (x.go:7) RET Some regalloc improvements should help considerably. Change-Id: I95bb5dd83e56afd70ae4e983f1d32dffd0c3d46a Reviewed-on: https://go-review.googlesource.com/13142Reviewed-by: Keith Randall <khr@golang.org>
-
- 04 Aug, 2015 9 commits
-
-
Keith Randall authored
Implement ITAB, selecting the itable field of an interface. Soften the lowering check to allow lowerings that leave generic but dead ops behind. (The ITAB lowering does this.) Change-Id: Icc84961dd4060d143602f001311aa1d8be0d7fc0 Reviewed-on: https://go-review.googlesource.com/13144Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
-
Josh Bleecher Snyder authored
I find myself always adding this in temporarily. Make it permanent. Change-Id: I1646b3930a07d0ea01840736ccd449b7fd24f06e Reviewed-on: https://go-review.googlesource.com/13141Reviewed-by: Keith Randall <khr@golang.org>
-
Josh Bleecher Snyder authored
Failure to treat control ops as live can lead to them being eliminated when they live in other blocks. Change-Id: I604a1977a3d3884b1f4516bea4e15885ce38272d Reviewed-on: https://go-review.googlesource.com/13138Reviewed-by: Keith Randall <khr@golang.org>
-
Josh Bleecher Snyder authored
They were being omitted after scheduling. Change-Id: Ia20e2dcb61fde9ec854918b958c3897bafd282a6 Reviewed-on: https://go-review.googlesource.com/13140Reviewed-by: Keith Randall <khr@golang.org>
-
Keith Randall authored
Don't put them in the control value's block. That may be many blocks up the dominator tree. Change-Id: Iab3ea36a890ffe0e355dadec7aeb676901c4f070 Reviewed-on: https://go-review.googlesource.com/13134Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
-
Josh Bleecher Snyder authored
This is helpful when debugging generated code. Change-Id: I268efa3593a03bb2c4e9f07d9034c004cd40df41 Reviewed-on: https://go-review.googlesource.com/13099Reviewed-by: Keith Randall <khr@golang.org>
-
Todd Neal authored
Rewrite ^{n}x to be ^{n % 2}x. This will eventually resolve a fuzz issue that breaks v1.5. Updates #11352 Change-Id: I1b3f93872d06222f9ff5f6fd5580178ebaf4c003 Reviewed-on: https://go-review.googlesource.com/13110Reviewed-by: Keith Randall <khr@golang.org>
-
Todd Neal authored
Change-Id: Ibb5169aade15190773ff7dd11b303c1f1345a0c2 Reviewed-on: https://go-review.googlesource.com/13100Reviewed-by: Keith Randall <khr@golang.org>
-
Keith Randall authored
The DFS scheduler doesn't do the right thing. If a Value x is used by more than one other Value, then x is put into the DFS queue when its first user (call it y) is visited. It is not removed and reinserted when the second user of x (call it z) is visited, so the dependency between x and z is not respected. There is no easy way to fix this with the DFS queue because we'd have to rip values out of the middle of the DFS queue. The new scheduler works from the end of the block backwards, scheduling instructions which have had all of their uses already scheduled. A simple priority scheme breaks ties between multiple instructions that are ready to schedule simultaneously. Keep track of whether we've scheduled or not, and make print() use the scheduled order if we have. Fix some shift tests that this change tickles. Add unsigned right shift tests. Change-Id: I44164c10bb92ae8ab8f76d7a5180cbafab826ea1 Reviewed-on: https://go-review.googlesource.com/13069Reviewed-by: Todd Neal <todd@tneal.org>
-
- 03 Aug, 2015 3 commits
-
-
Todd Neal authored
Reworks nilcheck to be performed by a depth first traversal of the dominator tree, keeping an updated map of the values that have been nil-checked during the traversal. benchmark old ns/op new ns/op delta BenchmarkNilCheckDeep1-8 1242 1825 +46.94% BenchmarkNilCheckDeep10-8 2397 3942 +64.46% BenchmarkNilCheckDeep100-8 29105 24873 -14.54% BenchmarkNilCheckDeep1000-8 2742563 265760 -90.31% BenchmarkNilCheckDeep10000-8 335690119 3157995 -99.06% benchmark old MB/s new MB/s speedup BenchmarkNilCheckDeep1-8 0.81 0.55 0.68x BenchmarkNilCheckDeep10-8 4.17 2.54 0.61x BenchmarkNilCheckDeep100-8 3.44 4.02 1.17x BenchmarkNilCheckDeep1000-8 0.36 3.76 10.44x BenchmarkNilCheckDeep10000-8 0.03 3.17 105.67x benchmark old allocs new allocs delta BenchmarkNilCheckDeep1-8 9 14 +55.56% BenchmarkNilCheckDeep10-8 9 23 +155.56% BenchmarkNilCheckDeep100-8 9 113 +1155.56% BenchmarkNilCheckDeep1000-8 9 1015 +11177.78% BenchmarkNilCheckDeep10000-8 9 10024 +111277.78% benchmark old bytes new bytes delta BenchmarkNilCheckDeep1-8 432 608 +40.74% BenchmarkNilCheckDeep10-8 1008 1496 +48.41% BenchmarkNilCheckDeep100-8 8064 11656 +44.54% BenchmarkNilCheckDeep1000-8 73728 145240 +96.99% BenchmarkNilCheckDeep10000-8 737280 2144411 +190.85% Change-Id: I0f86010e9823aec04aac744fdb589b65ec8acefc Reviewed-on: https://go-review.googlesource.com/12332Reviewed-by: David Chase <drchase@google.com>
-
Todd Neal authored
Modify tests to use a known value instead of comparing the backends directly. Change-Id: I32e804e12515885bd94c4f83644cbca03b018fea Reviewed-on: https://go-review.googlesource.com/13042Reviewed-by: Keith Randall <khr@golang.org>
-
Alexandru Moșoi authored
This is a follow up on https://go-review.googlesource.com/#/c/12420/ with some rules moved to AMD64 closer to the existing rules. Change-Id: Id346bb0fc4459b3c49b826a59cc74308a590310e Reviewed-on: https://go-review.googlesource.com/12906Reviewed-by: Keith Randall <khr@golang.org>
-
- 31 Jul, 2015 1 commit
-
-
Josh Bleecher Snyder authored
This fixes the crypto/subtle tests. Change-Id: Ie6e721eec3481f67f13de1bfbd7988e227793148 Reviewed-on: https://go-review.googlesource.com/13000Reviewed-by: Keith Randall <khr@golang.org>
-
- 30 Jul, 2015 6 commits
-
-
Josh Bleecher Snyder authored
The only types that remain in the ssa package are special compiler-only types. Change-Id: If957abf128ec0778910d67666c297f97f183b7ee Reviewed-on: https://go-review.googlesource.com/12933Reviewed-by: Keith Randall <khr@golang.org>
-
Josh Bleecher Snyder authored
Change-Id: I9cbb6d53a8c2302222b13d2f33b081b704208b8a Reviewed-on: https://go-review.googlesource.com/12932Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Todd Neal <todd@tneal.org>
-
Alexandru Moșoi authored
From compiling go there were 260 functions where XOR was needed. Much of the required changes for implementing XOR were already done in 12813. Change-Id: I5a68aa028f5ed597bc1d62cedbef3620753dfe82 Reviewed-on: https://go-review.googlesource.com/12901Reviewed-by: Keith Randall <khr@golang.org>
-
Josh Bleecher Snyder authored
The existing backend simply elides OCONVNOP. There's no reason for us to do any differently. Rather than insert ConvNops and then rewrite them away, stop creating them in the first place. Change-Id: I4bcbe2229fcebd189ae18df24f2c612feb6e215e Reviewed-on: https://go-review.googlesource.com/12810Reviewed-by: Keith Randall <khr@golang.org>
-
Todd Neal authored
Fix code generation error that resulted in a multi-argument NEGQ doasm: notfound ft=13 tt=13 00134 NEGQ AX, AX 13 13 Change-Id: I8b712d21a5523eccbae1f33ccea417844c27073e Reviewed-on: https://go-review.googlesource.com/12869Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
-
Keith Randall authored
Semi-regular merge from tip into ssa branch Change-Id: Ida553b5c504058347c0bdcb1a987727bdcea456b
-