Richard Biener via Gcc-patches <[email protected]> writes:
> On Mon, Apr 20, 2020 at 3:38 PM Segher Boessenkool
> <[email protected]> wrote:
>>
>> Hi!
>>
>> On Mon, Apr 20, 2020 at 09:56:34AM +0200, Richard Biener wrote:
>> > On Fri, Apr 17, 2020 at 10:51 PM Segher Boessenkool
>> > <[email protected]> wrote:
>> > > > Yeah well, but RTL is not in SSA form
>> > >
>> > > "Webs" are not the *same* as SSA, in a few crucial ways; but they serve
>> > > similar purposes: they both make code transformations easier to do.
>> > > Both do this by having more different (independent) names.
>> > >
>> > > > and there's no RTL IL verification
>> > > > in place to track degradation.
>> > >
>> > > Adding this isn't hard in principle. But currently it is violated all
>> > > over the place, including in backend code.
>> >
>> > It's a cheap excuse and clearly a lot of work. But we've done it for
>> > GIMPLE
>> > and it was clearly worth it. If only for documentation purposes.
>>
>> Yes, I very much agree :-) But how will we do this? Make it warnings
>> only, and have those opt-in (for a port) even?
>
> Add -fcheck-rtl, when you're ready (per port?) make it default for
> bootstrap. When you're even more "ready", turn it on with -fchecking
> (or --enable-checking=xyz).
What kind of condition would we be checking? That no register has two
definitions in the same block? Or something stronger?
Testing that -fweb would have no effect is expensive, since it requires
full UD chains. And there's a risk that optimisations could break the
condition accidentally. E.g.:
if (cond)
{
x = ...;
...use x...;
}
else
{
x = ...;
...use x...;
}
...use x...; // A, REG_DEAD x
If anything managed to fold away the need for x in A (e.g. combine),
it would then be required to rename x in one of the if/else blocks.
In some ways it feels like it would be easier to resurrect RTL SSA :-)
Thanks,
Richard