[PATCH] D24790: [LoopUnroll] Use the upper bound of the loop trip count to completely unroll loops

Haicheng Wu via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 3 07:58:37 PDT 2016


haicheng added inline comments.


> mzolotukhin wrote in LoopUnrollPass.cpp:779
> What if `TripCount` matches `MaxTripCount`? Will we think that we're using upper bound instead of the exact trip count in this case?

`TripCount `and `MaxTripCount `cannot both be non zero because `MaxTripCount `is computed only if `TripCount `is Zero.  If one is non zero, the other one must be zero.  If they are both zero, `FullUnrollTripCount `is zero and then we cannot enter here.

> mzolotukhin wrote in LoopUnroll.cpp:543
> Is it intentional that we can make `NeedConditional` true after it was set to false before that? From semantics it looks like this never happens (in this case we can assert it), but I'd like to make sure it was not overlooked. Did you intend to replace this `if` with `else if` as well?

I intended to replace `if `with `else if`.  Using complete unroll should not enter the `else if` part.  I think the change improves the readability.

> mzolotukhin wrote in tti-unroll-prefs.ll:14-16
> We could've just passed `-unroll-threshold` to overcome this. It might make sense to do it even now, so that the test doesn't break if UnrollPreferences are changed.

This loop has a break statement so that we cannot get the exact trip cont.  I think we cannot fully unroll the loop without my change.  Passing `-unroll-threshold `cannot overcome this.

Repository:
  rL LLVM

https://reviews.llvm.org/D24790





More information about the llvm-commits mailing list