[PR48866] three alternative fixes

Alexandre Oliva aoliva@redhat.com
Fri Jun 3 01:37:00 GMT 2011

Ugh, failed to refresh the patch file, resending with the correct one.

On May 30, 2011, Alexandre Oliva <aoliva@redhat.com> wrote:

> On May 30, 2011, Alexandre Oliva <aoliva@redhat.com> wrote:
>> 2. emit placeholders for replaceable DEFs and, when the DEFs are
>> expanded at their point of use, emit the expansion next to the
>> placeholder, rather than at the current stream.  The result of the
>> expansion is saved and used in debug insns that reference the
>> replaceable DEF.  If the result is forced into a REG shortly thereafter,
>> the code resulting from this is also emitted next to the placeholder,
>> and the saved expansion is updated.  If the USE is expanded before the
>> DEF, the insn stream resulting from the expansion is saved and emitted
>> at the point of the DEF.

> IMHO this is the riskiest of the 3 patches, for shuffling expansions
> around isn't exactly something I'm comfortable with.  There's a very
> real risk that moving the expansion of sub-expressions to their
> definition points may end up moving uses before definitions.

Upthread, I posted the wrong patch: instead of the one that tolerated
expanding DEFs before or after USEs, I posted a simplifying experiment
that seemed to fail, but it looks like I misinterpreted the results.

This revised and retested patch also records expansions in an array
rather than a pointer_map, and it avoids re-expanding DEFs when a USE is
expanded for the second time.  Although replaceable DEFs can only have
one USE, when the single USE appears in a call stmt, it can be expanded
twice.  I'm not sure whether it would be better to expand it twice and
let RTL optimizations drop any redundancies, or reuse the result of the
first expansion, like this patch does.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: expand-replaceable-back-in-place-pr48866.patch
Type: text/x-diff
Size: 13410 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20110603/12c4f894/attachment.bin>
-------------- next part --------------

Alexandre Oliva, freedom fighter    http://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/   FSF Latin America board member
Free Software Evangelist      Red Hat Brazil Compiler Engineer

More information about the Gcc-patches mailing list