[LLVMdev] Loop simplification

Andrew Trick atrick at apple.com
Tue Feb 1 15:01:13 PST 2011


On Feb 1, 2011, at 2:29 PM, Andrew Clinton wrote:

> On 02/01/2011 04:47 PM, Andrew Trick wrote:
>> 
>> I forgot to ask why you're doing this. If the goal is to remove a branch, that would typically be handled by BranchFolder during codegen after phis have been removed. I don't see a problem forcing the CFG to be more canonical earlier, but if the successor is in a deeper loop, then you could be eliminating a preheader and forcing compensation code into the loop. In fact, I wouldn't be surprised if some loop passes might want a single preheader.
>> 
>> -Andy
> 
> The goal is to make the LoopInfo pass return a single loop where I 
> expect a single loop (based on an input program that has a loop 
> containing an if statement - which seems to generate an outer loop and 
> an inner loop).  The particular block that seems to cause this is a 
> "loop.outer" that presumably gets added by one of the common 
> optimization passes.

That's probably because LoopSimplify split the loop to give it a single backedge. It's a feature. Beyond that I'm not the person to ask about it though.

-Andy



More information about the llvm-dev mailing list