This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Combine] Unusual behaviour in combine


Hi Segher,

 > If you want the const_vector for r97, you should look at the combination
 > that tries *that* insn together with 10 and 12.  Did it try that?  
Why not?

It did not attempt to combine all three, I'm not sure why not, I would 
have expected
it to, they are all in the same basic block.

I don't understand why in the other example
two insns were combined using a constant set by a third insn, but in 
this case three
insns must be combined, perhaps because in this example they are in the
same basic block and in the other example the constant is set outside 
the basic block?

On 14/06/2019 22:34, Segher Boessenkool wrote:
> On Wed, Jun 12, 2019 at 10:52:42AM +0000, Joel Hutton wrote:
>> A summary of the behaviour is:
>> when combining A -> B, the register equivalence notes of A are checked, the register notes of B are not checked.
>>
>> Is this expected behaviour?
> Yes.
>
> If it would use the notes on B to make the new insns, it would not need A
> *at all*.  This does not make much sense.
>
> A worse problem is that very often it will end up with an insn that cannot
> match, if it did use the note on i3.  combine does not try all ways it can
> transform your code, so it should use the more promising ways.
>
>> Combine does not check the REG_EQUAL note on insn 12, and does not try the equivalent pattern, using a const_vector instead of register 99.
>>
>> Trying 10 -> 12:
>>     10: r97:V4SF=float(r96:V4SI)
>>        REG_DEAD r96:V4SI
>>     12: r98:V4SF=r97:V4SF*r99:V4SF
>>        REG_DEAD r97:V4SF
>>        REG_EQUAL r97:V4SF*const_vector
>> Failed to match this instruction:
>> (set (reg:V4SF 98 [ D.3422 ])
>>      (mult:V4SF (float:V4SF (reg:V4SI 96 [ D.3420 ]))
>>          (reg:V4SF 99)))
> If you want the const_vector for r97, you should look at the combination
> that tries *that* insn together with 10 and 12.  Did it try that?  Why not?
>
>
> Segher

Attachment: tmp.c.262r.ud_dce
Description: tmp.c.262r.ud_dce

Attachment: tmp.c.263r.combine
Description: tmp.c.263r.combine


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]