Problem with peephole to peephole2 conversion

Paolo Bonzini paolo.bonzini@lu.unisi.ch
Thu Aug 25 10:34:00 GMT 2005


Ashwin wrote:
> The problem in front of me is something like this..
> 
> op0 = 1
> op1 = op0 leftshift op2
> 
> This will be optimized to
> op1 = 1 leftshift op2 (by the peephole2 pass to the rtl pattern 
> corresponding to this and hence the requirement that op0 should be dead 
> after insn2)
>
> However if the pattern happens to be something like this :
> 
> op0 = 1
> op0 = op0 leftshift op2
> ...
> use of op0 here
> ...
> 
> The pattern matches in any case.

You'll have something like this in your test

operands[0] == operands[1] || peep2_regno_dead_p (2, operands[0])

i.e. you only need to test for op0's death if it is different from op1.

Paolo



More information about the Gcc mailing list