Mesa (master): 22 new commits
Kenneth Graunke
kwg at kemper.freedesktop.org
Mon Aug 24 20:35:45 UTC 2015
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d7971b41ce3bd5ffce9580b3796b40d3591d6e5e
Author: Connor Abbott <cwabbott0 at gmail.com>
Date: Tue Jul 21 19:54:35 2015 -0700
nir/cf: reimplement nir_cf_node_remove() using the new API
This gives us some testing of it. Also, the old nir_cf_node_remove()
wasn't handling phi nodes correctly and was calling cleanup_cf_node()
too late.
Signed-off-by: Connor Abbott <connor.w.abbott at intel.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=fc7f2d2364a98d4ec8fb8627b03c6f84b353998c
Author: Connor Abbott <cwabbott0 at gmail.com>
Date: Tue Jul 21 19:54:34 2015 -0700
nir/cf: add new control modification API's
These will help us do a number of things, including:
- Early return elimination.
- Dead control flow elimination.
- Various optimizations, such as replacing:
if (foo) {
...
}
if (!foo) {
...
}
with:
if (foo) {
...
} else {
...
}
Signed-off-by: Connor Abbott <connor.w.abbott at intel.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=476eb5e4a16efdbc54c4418e44b1f38989026add
Author: Connor Abbott <cwabbott0 at gmail.com>
Date: Tue Jul 21 19:54:33 2015 -0700
nir/cf: use a cursor for inserting control flow
Signed-off-by: Connor Abbott <connor.w.abbott at intel.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d356f84d4ceb9fb63e4b254ab8b26ce891c2f2b9
Author: Connor Abbott <cwabbott0 at gmail.com>
Date: Tue Jul 21 19:54:32 2015 -0700
nir/cf: add split_block_cursor()
This is a helper that will be shared between the new control flow
insertion and modification code.
Signed-off-by: Connor Abbott <connor.w.abbott at intel.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=58a360c6b8aead1fec34aea298654ab544e7c8e8
Author: Connor Abbott <cwabbott0 at gmail.com>
Date: Tue Jul 21 19:54:31 2015 -0700
nir/cf: add split_block_before_instr()
Signed-off-by: Connor Abbott <connor.w.abbott at intel.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6e47a34b29459dcf977a8c1223805cb0a275a8c8
Author: Connor Abbott <cwabbott0 at gmail.com>
Date: Tue Jul 21 19:54:30 2015 -0700
nir/cf: add a cursor structure
For now, it allows us to refactor the control flow insertion API's so
that there's a single entrypoint (with some wrappers). More importantly,
it will allow us to reduce the combinatorial explosion in the extract
function. There, we need to specify two points to extract, which may be
at the beginning of a block, the end of a block, or in the middle of a
block. And then there are various wrappers based off of that (before a
control flow node, before a control flow list, etc.). Rather than having
9 different functions, we can have one function and push the actual
logic of determining which variant to use down to the split function,
which will be shared with nir_cf_node_insert().
In the future, we may want to make the instruction insertion API's as
well as the builder use this, but that's a future cleanup.
Signed-off-by: Connor Abbott <connor.w.abbott at intel.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6f5c81f86f9b1b08b57435562be657fb2d220408
Author: Connor Abbott <cwabbott0 at gmail.com>
Date: Tue Jul 21 19:54:29 2015 -0700
nir/cf: fix link_blocks() when there are no successors
When we insert a single basic block A into another basic block B, we
will split B into C and D, insert A in the middle, and then splice
together C, A, and D. When we splice together C and A, we need to move
the successors of A into C -- except A has no successors, since it
hasn't been inserted yet. So in move_successors(), we need to handle the
case where the block whose successors are to be moved doesn't have any
successors. Fixing link_blocks() here prevents a segfault and makes it
work correctly.
Signed-off-by: Connor Abbott <connor.w.abbott at intel.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6d028749ac593b6c724ab86a42bf969da47cc569
Author: Connor Abbott <cwabbott0 at gmail.com>
Date: Tue Jul 21 19:54:28 2015 -0700
nir/cf: clean up jumps when cleaning up CF nodes
We may delete a control flow node which contains structured jumps to
other parts of the program. We need to remove the jump as a predecessor,
as well as remove any phi node sources which reference it. Right now,
the same problem exists for blocks that don't end in a jump instruction,
but with the new API it shouldn't be an issue, since blocks that don't
end in a jump must either point to another block in the same extracted
CF list or not point to anything at all.
Signed-off-by: Connor Abbott <connor.w.abbott at intel.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=211c79515d2d4cde12cc6a19bb064692b2de3f26
Author: Connor Abbott <cwabbott0 at gmail.com>
Date: Tue Jul 21 19:54:27 2015 -0700
nir/cf: remove uses of SSA definitions that are being deleted
Unlike calling nir_instr_remove(), calling nir_cf_node_remove() (and
later in the series, the nir_cf_list_delete()) implies that you're
removing instructions that may still have uses, except those
instructions are never executed so any uses will be undefined. When
cleaning up a CF node for deletion, we must clean up any uses of the
deleted instructions by making them point to undef instructions instead.
Signed-off-by: Connor Abbott <connor.w.abbott at intel.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=633cbbc0682b1cec3107398a21a057697e8572aa
Author: Connor Abbott <cwabbott0 at gmail.com>
Date: Tue Jul 21 19:54:26 2015 -0700
nir/cf: handle jumps better in stitch_blocks()
In particular, handle the case where the earlier block ends in a jump
and the later block is empty. In that case, we want to preserve the jump
and remove any traces of the later block. Before, we would only hit this
case when removing a control flow node after a jump, which wasn't a
common occurance, but we'll need it to handle inserting a control flow
list which ends in a jump, which should be more common/useful.
Signed-off-by: Connor Abbott <connor.w.abbott at intel.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=940873bf22c90db79d065f14ff44dab12415feb0
Author: Connor Abbott <cwabbott0 at gmail.com>
Date: Tue Jul 21 19:54:25 2015 -0700
nir/cf: handle jumps in split_block_end()
Before, we would only split a block with a jump at the end if we were
inserting something after a block with a jump, which never happened in
practice. But now, we want to use this to extract control flow lists
which may end in a jump, in which case we really need to do the correct
patching up. As a side effect, when removing jumps we now correctly
insert undef phi sources in some corner cases, which can't hurt.
Signed-off-by: Connor Abbott <connor.w.abbott at intel.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f596e4021c4c1b2ce95ff32606e2f217955504bd
Author: Connor Abbott <cwabbott0 at gmail.com>
Date: Tue Jul 21 19:54:24 2015 -0700
nir/cf: add block_ends_in_jump()
Signed-off-by: Connor Abbott <connor.w.abbott at intel.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=788d45cb478d6285fe6811c87b4f1db1daded6d9
Author: Connor Abbott <cwabbott0 at gmail.com>
Date: Tue Jul 21 19:54:23 2015 -0700
nir/cf: handle phi nodes better in split_block_beginning()
Signed-off-by: Connor Abbott <connor.w.abbott at intel.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=747ddc3cdd51cc3786894e2ba56d86334a7051a5
Author: Connor Abbott <cwabbott0 at gmail.com>
Date: Tue Jul 21 19:54:22 2015 -0700
nir/cf: split up and improve nir_handle_remove_jumps()
Before, the process of removing a jump and wiring up the remaining block
correctly was atomic, but with the new control flow modification it's
split into two parts: first, we extract the jump, which creates a new
block with re-wired successors as well as a free-floating jump, and then
we delete the control flow containing the jump, which removes the entry
in the predecessors and any phi node sources. Split up
nir_handle_remove_jumps() to accomodate this, and add the missing
support for removing phi node sources.
Signed-off-by: Connor Abbott <connor.w.abbott at intel.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=13482111d0dd9649d4b14ed05df344d5a2cea3de
Author: Connor Abbott <cwabbott0 at gmail.com>
Date: Tue Jul 21 19:54:21 2015 -0700
nir/cf: add remove_phi_src() helper
Signed-off-by: Connor Abbott <connor.w.abbott at intel.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f41e108d8bdd360caedd1497dc676c928c7f18a3
Author: Connor Abbott <cwabbott0 at gmail.com>
Date: Tue Jul 21 19:54:20 2015 -0700
nir: add nir_foreach_phi_src_safe()
Signed-off-by: Connor Abbott <connor.w.abbott at intel.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=762ae436ea578651c9f8a50620196b5d744b8eee
Author: Connor Abbott <cwabbott0 at gmail.com>
Date: Tue Jul 21 19:54:19 2015 -0700
nir/cf: add insert_phi_undef() helper
Signed-off-by: Connor Abbott <connor.w.abbott at intel.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b49371b8ede380f10ea3ab333246a3b01ac6aca5
Author: Connor Abbott <cwabbott0 at gmail.com>
Date: Tue Jul 21 19:54:18 2015 -0700
nir: move control flow modification to its own file
We want to start reworking and expanding this code, but it'll be a lot
easier to do once we disentangle it from the rest of the stuff in nir.c.
Unfortunately, there are a few unavoidable dependencies in nir.c on
methods we'd rather not expose publicly, since if not used in very
specific situations they can cause Bad Things (tm) to happen. Namely, we
need to do some magical control flow munging when adding/removing jumps.
In the future, we may disallow adding/removing jumps in
nir_instr_insert_*() and nir_instr_remove(), and use separate functions
that are part of the control flow modification code, but for now we
expose them and put them in a separate, private header.
Signed-off-by: Connor Abbott <connor.w.abbott at intel.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=1c53f89696124de2c7e93665ef8b07bc17b2cb86
Author: Connor Abbott <cwabbott0 at gmail.com>
Date: Tue Jul 21 19:54:17 2015 -0700
nir: make cleanup_cf_node() not use remove_defs_uses()
cleanup_cf_node() is part of the control flow modification code, which
we're going to split into its own file, but remove_defs_uses() is an
internal function used by nir_instr_remove(). Break the dependency by
making cleanup_cf_node() use nir_instr_remove() instead, which simply
calls remove_defs_uses() and then removes the instruction from the list.
nir_instr_remove() does do extra things for jumps, though, so we avoid
calling it on jumps which matches the previous behavior (this will be
fixed later in the series).
Signed-off-by: Connor Abbott <connor.w.abbott at intel.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9d5944053ca7bed58b299211fe8028274d480b5b
Author: Connor Abbott <cwabbott0 at gmail.com>
Date: Tue Jul 21 19:54:16 2015 -0700
nir: inline block_add_pred() a few places
It was being used to initialize function impls and loops, even though
it's really a control flow modification helper. It's pretty trivial, so
just inline it to avoid the dependency.
Signed-off-by: Connor Abbott <connor.w.abbott at intel.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c7df141c71c3fa0bdbcf6d0bbd4b8158a35c7f5a
Author: Connor Abbott <cwabbott0 at gmail.com>
Date: Tue Jul 21 19:54:15 2015 -0700
nir/validate: check successors/predecessors more carefully
We should be checking almost everything now.
Signed-off-by: Connor Abbott <connor.w.abbott at intel.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=8e0d4ef3410ea07d9621df3e083bc3e7c1ad2ab0
Author: Kenneth Graunke <kenneth at whitecape.org>
Date: Thu Aug 6 18:18:40 2015 -0700
nir: Delete the nir_function_impl::start_block field.
It's simply the first nir_cf_node in the nir_function_impl::body list,
which is easy enough to access - we don't to store a pointer to it
explicitly. Removing it means we don't need to maintain the pointer
when, say, splitting the start block when modifying control flow.
Thanks to Connor Abbott for suggesting this.
Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Connor Abbott <cwabbott0 at gmail.com>
More information about the mesa-commit
mailing list