[llvm] r179957 - SimplifyCFG: If convert single conditional stores

Rafael EspĂ­ndola rafael.espindola at gmail.com
Wed Apr 24 11:57:43 PDT 2013


>> Yes, I truly understand that.  My point is that it is still a
>> canonicalization: depending on how the user wrote the code is silly for the
>> opposite reason: if they wrote code with ?: or max on pentium 4, codegen
>> should convert it to an "if" if the branch is biased.
>
>
> I feel like we need a better strategy long-term. Increasingly, I'm of the
> opinion that as we move away from the SelectionDAG's basic block
> limitations, we should also move away from canonicalizing to the
> if-converted code. These days I would rather see us add utilities to LLVM to
> look across basic blocks which form PHI-only CFGs as-if they were straight
> line code, and to have the canonical form of predicated values be PHI-only
> CFGs. This has a nice advantage of simplifying the IR model, and being
> strictly more general than selects. However, it *requires* that we don't
> have a basic-block granularity hard limitation in passes, and that's just
> not the world we live in currently. Maybe eventually.

Fully agree. We have some bugs where code gets optimized by gvn if its
using phis and we miss an optimization if we are using selects (or
vice versa).

In summary: we should have a canonical form in the IL. Currently, it
looks like a select is a better canonical form. In the future it might
be a phi.

Cheers,
Rafael



More information about the llvm-commits mailing list