- 22 Feb, 2016 1 commit
-
-
Alexandru Moșoi authored
* If a operation is commutative order the parameters in a canonical way. Size of pkg/tool/linux_amd64/* excluding compile: before: 95882288 after: 95868152 change: 14136 ~0.015% I tried something similar with Leq and Geq, but the results were not great because it confuses the 'lowered cse' pass too much which can no longer remove redundant comparisons from IsInBounds. Change-Id: I2f928663a11320bfc51c7fa47e384b7411c420ba Reviewed-on: https://go-review.googlesource.com/19727 Reviewed-by:
Keith Randall <khr@golang.org> Run-TryBot: Alexandru Moșoi <alexandru@mosoi.ro> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
- 09 Feb, 2016 1 commit
-
-
Alexandru Moșoi authored
* Phis can have variable number of arguments, but rulegen assumed that each operation has fixed number of arguments. * Rewriting Phis is necessary to handle the following case: func f1_ssa(a bool, x int) int { v := 0 if a { v = -1 } else { v = -1 } return x|v } Change-Id: Iff6bd411b854f3d1d6d3ce21934bf566757094f2 Reviewed-on: https://go-review.googlesource.com/19412 Reviewed-by:
Keith Randall <khr@golang.org>
-
- 06 Feb, 2016 1 commit
-
-
Keith Randall authored
The frontend does this for 32 bits and below, but SSA needs to do it for 64 bits. The algorithms are all copied from cgen.go:cgen_div. Speeds up TimeFormat substantially: ~40% slower to ~10% slower. Change-Id: I023ea2eb6040df98ccd9105e15ca6ea695610a7a Reviewed-on: https://go-review.googlesource.com/19302 Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by:
Todd Neal <todd@tneal.org>
-
- 02 Feb, 2016 1 commit
-
-
Keith Randall authored
Add the aux type to opcodes. Add rematerializeable as a flag. Change-Id: I906e19281498f3ee51bb136299bf26e13a54b2ec Reviewed-on: https://go-review.googlesource.com/19088 Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by:
Todd Neal <todd@tneal.org>
-
- 29 Jan, 2016 1 commit
-
-
Keith Randall authored
Compiling && and || expressions often leads to control flow of the following form: p: If a goto b else c b: <- p ... x = phi(a, ...) If x goto t else u Note that if we take the edge p->b, then we are guaranteed to take the edge b->t also. So in this situation, we might as well go directly from p to t. Change-Id: I6974f1e6367119a2ddf2014f9741fdb490edcc12 Reviewed-on: https://go-review.googlesource.com/18910 Reviewed-by:
David Chase <drchase@google.com>
-
- 20 Jan, 2016 2 commits
-
-
Keith Randall authored
Break small structs up into their components so they can be registerized. Change StructSelect to use field indexes instead of field offsets, as field offsets aren't unique in the presence of zero-sized fields. Change-Id: I2f1dc89f7fa58e1cf58aa1a32b238959d53f62e4 Reviewed-on: https://go-review.googlesource.com/18570 Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by:
David Chase <drchase@google.com>
-
Keith Randall authored
Redo how we keep track of forward references when building SSA. When the forward reference is resolved, update the Value node in place. Improve the phi elimination pass so it can simplify phis of phis. Give SSA package access to decoded line numbers. Fix line numbers for constant booleans. Change-Id: I3dc9896148d260be2f3dd14cbe5db639ec9fa6b7 Reviewed-on: https://go-review.googlesource.com/18674 Reviewed-by:
David Chase <drchase@google.com> Run-TryBot: Keith Randall <khr@golang.org>
-
- 11 Nov, 2015 1 commit
-
-
Keith Randall authored
Make sure that when a pointer value is live across a function call, we save it as a pointer. (And similarly a uintptr live across a function call should not be saved as a pointer.) Add a nasty test case. This is probably what is preventing the merge from master to dev.ssa. Signs point to something like this bug happening in mallocgc. Change-Id: Ib23fa1251b8d1c50d82c6a448cb4a4fc28219029 Reviewed-on: https://go-review.googlesource.com/16830 Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by:
David Chase <drchase@google.com>
-
- 10 Nov, 2015 1 commit
-
-
Keith Randall authored
Some optimizations of things I've seen looking at generated code. (x+y)-x == y x-0 == x The ptr portion of the constant string "" can be nil. Also update TODO with recent changes. Change-Id: I02c41ca2f9e9e178bf889058d3e083b446672dbe Reviewed-on: https://go-review.googlesource.com/16771 Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by:
David Chase <drchase@google.com>
-
- 03 Nov, 2015 2 commits
-
-
Keith Randall authored
Declare a function's arguments as having already been spilled so their use just requires a restore. Allow spill locations to be portions of larger objects the stack. Required to load portions of compound input arguments. Rename the memory input to InputMem. Use Arg for the pre-spilled argument values. Change-Id: I8fe2a03ffbba1022d98bfae2052b376b96d32dda Reviewed-on: https://go-review.googlesource.com/16536 Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by:
David Chase <drchase@google.com>
-
Keith Randall authored
Be more consistent about this. There's no reason to do the pointer arithmetic on a different type, as sizeof(int) >= sizeof(ptr) on all of our platforms. It simplifies our rewrite rules also, except for a few that need duplication. Add some more constant folding to get constant indexing and slicing to fold down to nothing. Change-Id: I3e56cdb14b3dc1a6a0514f0333e883f92c19e3c7 Reviewed-on: https://go-review.googlesource.com/16586 Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by:
David Chase <drchase@google.com>
-
- 25 Oct, 2015 1 commit
-
-
Keith Randall authored
Use faulting loads instead of test/jeq to do nil checks. Fold nil checks into a following load/store if possible. Makes binaries about 2% smaller. Change-Id: I54af0f0a93c853f37e34e0ce7e3f01dd2ac87f64 Reviewed-on: https://go-review.googlesource.com/16287 Reviewed-by:
David Chase <drchase@google.com>
-
- 23 Oct, 2015 1 commit
-
-
David Chase authored
Modified GOSSA{HASH.PKG} environment variable filters to make it easier to make/run with all SSA for testing. Disable attempts at SSA for architectures that are not amd64 (avoid spurious errors/unimplementeds.) Removed easy out for unimplemented features. Add convert op for proper liveness in presence of uintptr to/from unsafe.Pointer conversions. Tweaked stack sizes to get a pass on windows; 1024 instead 768, was observed to pass at least once. Change-Id: Ida3800afcda67d529e3b1cf48ca4a3f0fa48b2c5 Reviewed-on: https://go-review.googlesource.com/16201 Reviewed-by:
Keith Randall <khr@golang.org> Run-TryBot: David Chase <drchase@google.com>
-
- 20 Oct, 2015 1 commit
-
-
Keith Randall authored
getg reads from memory, so it should really have a memory arg. It is critical in functions which call setg to make sure getg gets ordered correctly with setg. Change-Id: Ief4875421f741fc49c07b0e1f065ce2535232341 Reviewed-on: https://go-review.googlesource.com/16100 Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by:
David Chase <drchase@google.com> Run-TryBot: David Chase <drchase@google.com>
-
- 22 Sep, 2015 1 commit
-
-
David Chase authored
Cleaned up first-block-in-function code. Added cases for |PHEAP for PPARAM and PAUTO. Made PPARAMOUT act more like PAUTO for purposes of address generation and vardef placement. Added cases for OCLOSUREVAR and Ops for getting closure pointer. Closure ops are scheduled at top of entry block to capture DX. Wrote test that seems to show proper behavior for addressed parameters, locals, and returns. Change-Id: Iee93ebf9e3d9f74cfb4d1c1da8038eb278d8a857 Reviewed-on: https://go-review.googlesource.com/14650 Reviewed-by:
Keith Randall <khr@golang.org> Run-TryBot: David Chase <drchase@google.com>
-
- 21 Sep, 2015 1 commit
-
-
Keith Randall authored
There's no need for special ops for panicindex and panicslice. Just use regular runtime calls. Change-Id: I71b9b73f4f1ebce1220fdc1e7b7f65cfcf4b7bae Reviewed-on: https://go-review.googlesource.com/14726 Reviewed-by:
David Chase <drchase@google.com>
-
- 17 Sep, 2015 1 commit
-
-
Keith Randall authored
OCALLINTER, as well as ODEFER/OPROC with OCALLMETH/OCALLINTER. Move all the call logic to its own routine, a lot of the code is shared. Change-Id: Ieac59596165e434cc6d1d7b5e46b78957e9c5ed3 Reviewed-on: https://go-review.googlesource.com/14464 Reviewed-by:
Todd Neal <todd@tneal.org> Reviewed-by:
David Chase <drchase@google.com>
-
- 16 Sep, 2015 1 commit
-
-
Keith Randall authored
A simpler way to do iface/slice comparisons. Fixes some cases of failed lowerings. Change-Id: Ia252bc8648293a2d460f63c41f1591785543a1e9 Reviewed-on: https://go-review.googlesource.com/14493 Reviewed-by:
Josh Bleecher Snyder <josharian@gmail.com>
-
- 12 Sep, 2015 1 commit
-
-
Keith Randall authored
Change-Id: Iec61ca1bdc064c29ceca6d47f600d5643d0a64dd Reviewed-on: https://go-review.googlesource.com/14533 Reviewed-by:
Brad Fitzpatrick <bradfitz@golang.org>
-
- 11 Sep, 2015 1 commit
-
-
Keith Randall authored
Move to implicit (mostly) instead of explicit exit blocks. RET and RETJMP have no outgoing edges - they implicitly exit. CALL only has one outgoing edge, as its exception edge is implicit as well. Exit blocks are only used for unconditionally panicking code, like the failed branches of nil and bounds checks. There may now be more than one exit block. No merges happen at exit blocks. The only downside is it is harder to find all the places code can exit the method. See the reverse dominator code for an example. Change-Id: I42e2fd809a4bf81301ab993e29ad9f203ce48eb0 Reviewed-on: https://go-review.googlesource.com/14462 Reviewed-by:
Josh Bleecher Snyder <josharian@gmail.com>
-
- 09 Sep, 2015 2 commits
-
-
Keith Randall authored
Change-Id: I352c7b9aab053959bc74c15861339e1dbe545ddc Reviewed-on: https://go-review.googlesource.com/14404 Reviewed-by:
David Chase <drchase@google.com>
-
Keith Randall authored
Make sure that return blocks take a store as their control. Without this, code was getting inserted between the return and exit blocks. Use AEND to mark the end of code. The live variable analysis gets confused when routines end like: JMP earlier RET because the RET is unreachable. The RET was incorrectly added to the last basic block, rendering the JMP invisible to the CFG builder. Change-Id: I91b32c8b37075347243ff039b4e4385856fba7cd Reviewed-on: https://go-review.googlesource.com/14398 Reviewed-by:
Josh Bleecher Snyder <josharian@gmail.com>
-
- 07 Sep, 2015 1 commit
-
-
Keith Randall authored
VarDef declarations are getting in the way of rewriting load/store pairs into moves. This change fixes that, albeit in a really hacky way. Better options would be appreciated. Increases coverage during make.bash from 67% to 71%. Change-Id: I336e967687e2238c7d0d64e3b37132a731ad15c3 Reviewed-on: https://go-review.googlesource.com/14347 Reviewed-by:
Josh Bleecher Snyder <josharian@gmail.com>
-
- 06 Sep, 2015 1 commit
-
-
Keith Randall authored
TODO: for now, just function calls. Do method and interface calls. Change-Id: Ib262dfa31cb753996cde899beaad4dc2e66705ac Reviewed-on: https://go-review.googlesource.com/14035 Reviewed-by:
Josh Bleecher Snyder <josharian@gmail.com>
-
- 05 Sep, 2015 2 commits
-
-
Keith Randall authored
This change is all about leveraging the gc bitmap generation that is already done by the current compiler. We rearrange how stack allocation is done so that we generate a variable declaration for each spill. We also reorganize how args/locals are recorded during SSA. Then we can use the existing allocauto/defframe to allocate the stack frame and liveness to make the gc bitmaps. With this change, stack copying works correctly and we no longer need hacks in runtime/stack*.go to make tests work. GC is close to working, it just needs write barriers. Change-Id: I990fb4e3fbe98850c6be35c3185a1c85d9e1a6ba Reviewed-on: https://go-review.googlesource.com/13894 Reviewed-by:
David Chase <drchase@google.com> Reviewed-by:
Josh Bleecher Snyder <josharian@gmail.com>
-
Todd Neal authored
Rewite user nil checks as OpIsNonNil so our nil check elimination pass can take advantage and remove redundant checks. With make.bash this removes 10% more nilchecks (34110 vs 31088). Change-Id: Ifb01d1b6d2d759f5e2a5aaa0470e1d5a2a680212 Reviewed-on: https://go-review.googlesource.com/14321 Reviewed-by:
Keith Randall <khr@golang.org> Reviewed-by:
Josh Bleecher Snyder <josharian@gmail.com>
-
- 03 Sep, 2015 1 commit
-
-
Keith Randall authored
It is confusing to have exceptional edges jump back into real code. Distinguish return blocks, which execute acutal code, and the exit block, which is a merge point for the regular and exceptional return flow. Prevent critical edge insertion from adding blocks on edges into the exit block. These added blocks serve no purpose and add a bunch of dead jumps to the assembly output. Furthermore, live variable analysis is confused by these jumps. Change-Id: Ifd69e6c00e90338ed147e7cb351b5100dc0364df Reviewed-on: https://go-review.googlesource.com/14254 Reviewed-by:
David Chase <drchase@google.com>
-
- 01 Sep, 2015 2 commits
-
-
David Chase authored
Still to do: details, more testing corner cases. (e.g. negative zero) Includes small cleanups for previous CL. Note: complex division is currently done in the runtime, so the division code here is apparently not yet necessary and also not tested. Seems likely better to open code division and expose the widening/narrowing to optimization. Complex64 multiplication and division is done in wide format to avoid cancellation errors; for division, this also happens to be compatible with pre-SSA practice (which uses a single complex128 division function). It would-be-nice to widen for complex128 multiplication intermediates as well, but that is trickier to implement without a handy wider-precision format. Change-Id: I595a4300f68868fb7641852a54674c6b2b78855e Reviewed-on: https://go-review.googlesource.com/14028 Reviewed-by:
Keith Randall <khr@golang.org>
-
Keith Randall authored
Specifying types in rewrites for all subexpressions gets verbose quickly. Allow opcodes to specify a default type which is used when none is supplied explicitly. Provide default types for a few easy opcodes. There are probably more we can do, but this is a good start. Change-Id: Iedc2a1a423cc3e2d4472640433982f9aa76a9f18 Reviewed-on: https://go-review.googlesource.com/14128 Reviewed-by:
Josh Bleecher Snyder <josharian@gmail.com>
-
- 29 Aug, 2015 1 commit
-
-
Keith Randall authored
Instead of trying to delete dead code as soon as we find it, just mark it as dead using a PlainAndDead block kind. The deadcode pass will do the real removal. This way is somewhat more efficient because we don't need to mess with successor and predecessor lists of all the dead blocks. Fixes #12347 Change-Id: Ia42d6b5f9cdb3215a51737b3eb117c00bd439b13 Reviewed-on: https://go-review.googlesource.com/14033 Reviewed-by:
Josh Bleecher Snyder <josharian@gmail.com>
-
- 28 Aug, 2015 1 commit
-
-
David Chase authored
Still to do: arithmetic Change-Id: I31fd23b34980c9ed4b4e304b8597134b2ba6ca5c Reviewed-on: https://go-review.googlesource.com/14024 Reviewed-by:
Keith Randall <khr@golang.org>
-
- 25 Aug, 2015 4 commits
-
-
Keith Randall authored
Change-Id: I3c598faff8af18530ae863b9e72f0cef379b4a1f Reviewed-on: https://go-review.googlesource.com/13909 Reviewed-by:
Brad Fitzpatrick <bradfitz@golang.org>
-
Keith Randall authored
Add a new function and generic operation to handle bounds checking for slices. Unlike the index bounds checking the index can be equal to the upper bound. Do gc-friendly slicing that generates proper code for 0-length result slices. This is a takeover of Alexandru's original change, (https://go-review.googlesource.com/#/c/12764/) submittable now that the decompose phase is in. Change-Id: I17d164cf42ed7839f84ca949c6ad3289269c9160 Reviewed-on: https://go-review.googlesource.com/13903 Reviewed-by:
David Chase <drchase@google.com>
-
David Chase authored
Basic ops, no particular optimization in the pattern matching yet (e.g. x!=x for Nan detection, x cmp constant, etc.) Change-Id: I0043564081d6dc0eede876c4a9eb3c33cbd1521c Reviewed-on: https://go-review.googlesource.com/13704 Reviewed-by:
Keith Randall <khr@golang.org>
-
David Chase authored
Change-Id: I8c17f706a3e0f1fa2d754bfb4ccd1f7a027cb3db Reviewed-on: https://go-review.googlesource.com/13744 Reviewed-by:
Keith Randall <khr@golang.org>
-
- 21 Aug, 2015 1 commit
-
-
Todd Neal authored
Change-Id: Iec954c4daefef4ab3fa2c98bfb2c70b2dea8dffb Reviewed-on: https://go-review.googlesource.com/13743 Reviewed-by:
Keith Randall <khr@golang.org>
-
- 20 Aug, 2015 1 commit
-
-
Keith Randall authored
Decompose breaks compound objects up into pieces that can be operated on by the target architecture. The decompose pass only does phi ops, the rest is done by the rewrite rules in generic.rules. Compound objects include strings,slices,interfaces,structs,arrays. Arrays aren't decomposed because of indexing (we could support constant indexes, but dynamic indexes can't be handled using SSA). Structs will come in a subsequent CL. TODO: after this pass we have lost the association between, e.g., a string's pointer and its size. It would be nice if we could keep that information around for debugging info somehow. Change-Id: I6379ab962a7beef62297d0f68c421f22aa0a0901 Reviewed-on: https://go-review.googlesource.com/13683 Reviewed-by:
Josh Bleecher Snyder <josharian@gmail.com>
-
- 19 Aug, 2015 2 commits
-
-
Keith Randall authored
Implement index check panics (and slice check panics, for when we need those). Clean up nil check. Now that the new regalloc is in we can use the register we just tested as the address 0 destination. Remove jumps after panic calls, they are unreachable. Change-Id: Ifee6e510cdea49cc7c7056887e4f06c67488d491 Reviewed-on: https://go-review.googlesource.com/13687 Reviewed-by:
Josh Bleecher Snyder <josharian@gmail.com>
-
Todd Neal authored
Adds support for high multiply which is used by the frontend when rewriting const division. The frontend currently only does this for 8, 16, and 32 bit integer arithmetic. Change-Id: I9b6c6018f3be827a50ee6c185454ebc79b3094c8 Reviewed-on: https://go-review.googlesource.com/13696 Reviewed-by:
Keith Randall <khr@golang.org>
-
- 18 Aug, 2015 1 commit
-
-
Todd Neal authored
Implement integer division for non-consts. Change-Id: If40cbde20e5f0ebb9993064def7be468e4eca076 Reviewed-on: https://go-review.googlesource.com/13644 Reviewed-by:
Keith Randall <khr@golang.org>
-