Per the request of Evgeny, I add a few sentences in the comments to clarif when TripCount contains the upper bound value.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
Hi Evgeny,
Would you please take a look at what I modified? Please let me know if it is what you want.
Thank you,
Haicheng
Hi Haicheng,
The comment is still confusing, at least to me. For instance, this sentence:
... Parameter TripCount may contain the exact number or the upper bound.
repeats what we've said in:
... In other words, control may exit the loop prior to TripCount iterations via an early branch, but control may not exit the loop from the LatchBlock's terminator prior to TripCount iterations.
At least, it looks very much the same.
AFAIU, now we started to handle cases where the loop may exit from the LatchBlock's terminator prior to TripCount iterations - am I right here? If so, can we somehow reflect it in the comment (maybe reword it entirely)?
Thanks,
Michael
You are absolutely correct. Let me try to rephrase it. Do you have any suggestions?
Thanks,
Haicheng
How about rewriting the whole paragraph as this?
TripCount is the upper bound of the iteration on which control exits LatchBlock. Control may exit the loop prior to TripCount iterations either via an early branch of other loop block or via LatchBlock terminator. This is relaxed from the general definition of trip count which is the number of times the loop header executes. Note that UnrollLoop assumes that the loop counter test is in LatchBlock in order to remove unnecesssary instances of the test.