[PATCH] D16612: [LoopVersioning] Expose loop versioning as a pass too

Adam Nemet via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 2 09:29:41 PST 2016

anemet marked 2 inline comments as done.
anemet added a comment.

Thanks for the review, Silviu.

In http://reviews.llvm.org/D16612#340485, @sbaranga wrote:

> Are you planning on using this for anything other than unit testing?

Not really other than for experimentation.  I may propose a patch to schedule an off-by-default  versioning early on in the pass pipeline.  This could be tool for finding missed optimization due to incomplete alias information.

I also just wanted to mention the llvm-dev thread where this was discussed:


Comment at: lib/Transforms/Utils/LoopVersioning.cpp:180
@@ +179,3 @@
+      const LoopAccessInfo &LAI = LAA->getInfo(L, ValueToValueMap());
+      if (LAI.getNumRuntimePointerChecks()) {
+        LoopVersioning LVer(LAI, L, LI, DT, SE);
sbaranga wrote:
> This needs to be (LAI.getNumRuntimePointerChecks() || !LAI.PSE.getUnionPredicate().isAlwaysTrue()).
> Maybe it would also make sense to have a separate method in LAI for this logic (something like needsRuntimeChecks()?)
Ah, of course, thanks for catching this!

I didn't add a separate method because looking at the clients, it suggest that the pattern of usage is more like:

* check the number of memchecks, optionally by filtering the checks, fail if too many
* check the number of SCEV predicate checks, fail if too many
* if any was needed, version


More information about the llvm-commits mailing list