[LLVMdev] Loop simplification
Andrew Trick
atrick at apple.com
Tue Feb 1 21:05:15 PST 2011
On Feb 1, 2011, at 3:58 PM, Andrew Clinton wrote:
> On 02/01/2011 06:43 PM, Frits van Bommel wrote:
>> I don't think that's always possible.
>> For example: if a phi in the successor has a phi in the predecessor as
>> one of it's incoming values, then the predecessor cases have to be
>> merged into the successor phi. However, if they share a predecessor
>> but have different incoming values for it that can't be done.
>
> You're right. I think it's possible to avoid this (and all other?)
> failing cases by ensuring that the predecessor dominates the successor
> before trying to merge them. If the dominance relationship is not true,
> it may not be possible to merge them.
>
> Andrew
That simplifies your implementation, but it's really unnecessary to handle this case. The CFG+phi transformation is still valid. As long as you avoid creating new critical edges, then the phis will always be representable (leave a single predecessor block on the branch targets).
-Andy
More information about the llvm-dev
mailing list