[PATCH] PR/44970, fix broken fwprop incremental dataflow

Paolo Bonzini bonzini@gnu.org
Mon Oct 18 22:49:00 GMT 2010


It turns out fwprop has been incredibly broken since it's inception.  :(

Its incremental dataflow update looks at the uses in the instruction 
before propagation, and creates new uses based on their presence after 
propagation.  But when fwprop copy propagates a pseudo into another 
instruction, it misses the uses of the propagated pseudo.  I find it 
incredible that this never triggered in so many years.

To fix the problem, the patch does not look at the old uses, and instead 
reconstructs them using df-scan.  To do this it cannot use 
df_insn_rescan, because this would remove the old defs and make the 
use->def links dangling.  So I just created a new function 
df_uses_create that scans an instruction and creates new refs like 
df_ref_create would have done.

With this in place, there is the question of how to create use->def 
links for the new uses.  The old way to do the updates could easily 
create the links because, by knowing a correspondence from old to new 
uses, it could reuse each old use's def link.

The new scheme, instead, is based on the following observation: the new 
uses can only refer to very few pseudos, those in the propagated-from 
insn and those in the propagated-to insn. fwprop walks the uses in the 
two insns and prepares in advance a map from pseudos to their defs. 
When checking is enabled, I added assertions that the values of the 
array indeed were set for the right insns.

Bootstrapped/regtested x86_64-pc-linux-gnu, bootstrapped on 
hppa64-hp-hpux11.11 by Steve Ellcey.

Ok for mainline?

Paolo
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: gcc-fwprop.patch
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20101018/ae1aedc5/attachment.ksh>


More information about the Gcc-patches mailing list