[LLVMdev] LoopInfo getTripCount modification proposal

Chris Lattner clattner at apple.com
Tue Sep 30 18:56:22 PDT 2008


On Sep 30, 2008, at 11:44 AM, Nadav wrote:

> Hi,
>
> I am trying to modify a loop by reducing the loop trip count from N  
> to N-1 where N may be constant.

Wouldn't that break the semantics of the loop?

> I looked into using getTripCount[1] but discovered that this method  
> returns a Value* which is N itself. This prevents me from using this  
> method for changing the loop. I suggest creating another method for  
> returning the 'cmp' instruction. The new getTripCount implementation  
> will use the new method. Do y'all think that it's a good idea and  
> accept a patch ?

There is no one condition in general that will do this.  It would be  
best to start this out as a helper function in your pass.  If there is  
a second client that needs this, we could move this into the LoopInfo/ 
Loop classes.

-Chris



More information about the llvm-dev mailing list