On Mon, Nov 9, 2020 at 1:47 PM Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote: > > Is duplicating the conditional branch worth it? In this case, clearly > yes. But in general? Maybe we could do it in cases like this, when the > *only* thing in a basic block is that conditional branch. Actually, I think the correct thing to do would be not to move the conditional branch into the parents, but instead: (a) if we see an unconditional branch to a bb with (only) a conditional one then (b) we look if the current BB is dominated by the same conditional, and if so, we follow the conditional one the right way. and that would immediately get us to that cbr %arg1, .L1, .L2 .L1: context 1 br .L5 .L2: call use, %r1 br .L4 state, without that possibly expanding "duplicate the conditional branches into the parent bb's". But the current flow rewriting isn't smart enough to do even this fairly simple thing. Linus