https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122518
--- Comment #5 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to Uroš Bizjak from comment #4)
> > *** This bug has been marked as a duplicate of bug 3507 ***
>
> OK, let me analyse PR3507.
PR3507 explicitly says:
(set (reg/v:SI 61)
(minus:SI (reg/v:SI 59) (reg/v:SI 60)))
and
(set (reg:CC 17 flags)
(compare:CC (reg/v:SI 59) (reg/v:SI 60)))
are not LOG_LINK related, because they share no common
destination, so combine doesn't merge them. [...]
This is not the case in this PR. With the patch, combine is able to create:
> Trying 10 -> 11:
> 10: {r102:SI=r100:SI-r109:SI;clobber flags:CC;}
> REG_UNUSED flags:CC
> REG_DEAD r109:SI
> 11: flags:CC=cmp(r100:SI,r102:SI)
> Successfully matched this instruction:
> (parallel [
> (set (reg:CC 17 flags)
> (compare:CC (reg/v:SI 100 [ a ])
> (reg:SI 109 [ b ])))
> (set (reg:SI 102 [ _5 ])
> (minus:SI (reg/v:SI 100 [ a ])
> (reg:SI 109 [ b ])))
> ])
So, the problem in PR3507 is orthogonal and fundamentally different. Probably
something for tree optimizers to handle, they have somehow higher level view of
the problem.