LoopInfo getTripCount modification proposal

Hi,

I am trying to modify a loop by reducing the loop trip count from N to N-1 where N may be constant. 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 ?

Nadav Rotem

[1] http://llvm.org/doxygen/LoopInfo_8h-source.html#l00394

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