Double test conversion pass

Double test conversion pass is a pass discovering conditionals in the form of (cond1||cond2) or (cond1&&cond3) and contained in the same superblock and attempts to construct equivalent sequences without branch instruction. In the trivial case a||b this can be done by converting into arithmetics a|b that in i386 instruction set even compiles into equivalently long code in case both variables are present in registers.

The idea can be generalized for example to convert, for instance, a==x||a==y into (a^x)|(a^y). We have implemented special function attempting to convert conditional into expression that is non-NULL when conditional is true, and use it to combine two instructions, algebraically simplify the resulting expressions and test whether resulting sequence is probably cheaper than the former. If so, we do the replacement.

We measured this optimization to improve SPEC2000 performance by about $ 0.3\%$. We expect the transformation to be more successful on EPIC architectures, but we have not tried it yet.



Jan Hubicka 2003-05-04