Hi Oleg, +/* +This pass tries to optimize for example this: + mov.l @(4,r4),r1 + tst r1,r1 + movt r1 + tst r1,r1 + bt/s .L5 + +into something simpler: + mov.l @(4,r4),r1 + tst r1,r1 + bf/s .L5 + +Such sequences can be identified by looking for conditional branches and +checking whether the ccreg is set before the conditional branch +by testing another register for != 0, which was set by a ccreg store. +This can be optimized by eliminating the redundant comparison and +inverting the branch condition. There can be multiple comparisons in +different basic blocks that all end up in the redunant test insn before the +conditional branch. Some example RTL ... +
Nice things to optimize the sequences when t-bit values are not recognized due to branches direction, I have 2 questions 1) I find the name "if-conversion" for this pass a little bit forced, since you don't aim to remove branches. If looks more like some kind of extension value numbering. 2) I'm wondering in which extend this case could be handled by a more global generic target value numbering to handle boolean operations. Maybe just a phasing problem as the branch directions are not yet computed in gimple-ssa, which would mean reworking in RTL ? Many thanks, Christian