<div dir="ltr">On 12 August 2013 13:11, Kenneth Graunke <span dir="ltr"><<a href="mailto:kenneth@whitecape.org" target="_blank">kenneth@whitecape.org</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">fs_copy_prop_dataflow::setup_kills() walks through each basic block's<br>
instructions, looking for instructions which overwrite registers used<br>
in ACP entries.<br>
<br>
This would be fine, except that it didn't exclude the instructions<br>
which generated the ACP entries in the first place. This meant that<br>
every copy was killed by its own generating instruction, making the<br>
dataflow analysis useless.<br></blockquote><div><br></div><div>I don't think this is actually a problem, because the bd[b].kills bits are only used to prevent liveness information from being propagated from bd[b].livein to bd[b].liveout, and the fs_copy_prop_dataflow constructor initializes bd[b].liveout with the set of ACP's that are generated from block b. So the only situation in which your patch would allow liveness information to be propagated from bd[b].livein to bd[b].liveout is for bits in bd[b].liveout that are already set.<br>
<br></div><div>Or am I misunderstanding things? <br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
To fix this, this patch records the generating instruction in the<br>
ACP entry. It then skips the kill checks when processing that<br>
instruction.<br>
<br>
Using a void pointer ensures it will only be used for comparisons,<br>
and not dereferenced.<br>
<br>
Signed-off-by: Kenneth Graunke <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>><br>
---<br>
src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp | 9 +++++++--<br>
1 file changed, 7 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp<br>
index d8d1546..379605c 100644<br>
--- a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp<br>
+++ b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp<br>
@@ -42,6 +42,9 @@ namespace { /* avoid conflict with opt_copy_propagation_elements */<br>
struct acp_entry : public exec_node {<br>
fs_reg dst;<br>
fs_reg src;<br>
+<br>
+ /** MOV instruction which generated this copy/ACP entry. */<br>
+ void *inst;<br>
};<br>
<br>
struct block_data {<br>
@@ -146,8 +149,9 @@ fs_copy_prop_dataflow::setup_kills()<br>
continue;<br>
<br>
for (int i = 0; i < num_acp; i++) {<br>
- if (inst->overwrites_reg(acp[i]->dst) ||<br>
- inst->overwrites_reg(acp[i]->src)) {<br>
+ if (inst != acp[i]->inst &&<br>
+ (inst->overwrites_reg(acp[i]->dst) ||<br>
+ inst->overwrites_reg(acp[i]->src))) {<br>
BITSET_SET(bd[b].kill, i);<br>
}<br>
}<br>
@@ -418,6 +422,7 @@ fs_visitor::opt_copy_propagate_local(void *mem_ctx, bblock_t *block,<br>
acp_entry *entry = ralloc(mem_ctx, acp_entry);<br>
entry->dst = inst->dst;<br>
entry->src = inst->src[0];<br>
+ entry->inst = inst;<br>
acp[entry->dst.reg % ACP_HASH_SIZE].push_tail(entry);<br>
}<br>
}<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.8.3.4<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div></div>