simplify CBR-CBR on the same condition
commit7cd2ce022575fbd383bb39b54f1e0fa402919da2
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>
Mon, 9 Nov 2020 23:00:31 +0000 (10 00:00 +0100)
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>
Tue, 17 Nov 2020 17:04:58 +0000 (17 18:04 +0100)
tree2223a38d76965f0e701ce5459f379ad8edb9da77
parent35b1a31ca12eba4c404f4616f768d75ea640302f
simplify CBR-CBR on the same condition

In situations like:
...
cbr <cond>, L1, L2

L1: L2:
... ...

L3:
cbr <cond>, L4, L5

since the conditions are the same and L3 is empty but the CBR,
all branches to L3 in L1 can be changed to branches to L4
(idem with L5 in L2). The same can be done in all BB 'in the
path between L1 and L3', more exactly in all BB dominated by L1,
this guarantee that the changes is only done on the BB where
the conditions match.

Note: This simplification kinda generalizes the current
      simplify_branch_branch() but should itself generalized
      to handle the presence of phi-sources in L3.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
flow.c