[PATCH] D19827: Do not disable completely loop unroll according to optimization level.

Chad Rosier via cfe-commits cfe-commits at lists.llvm.org
Mon May 2 19:48:07 PDT 2016


mcrosier added a subscriber: mcrosier.
mcrosier added a comment.

I believe the LLVM blog post is in error.  Loop vectorization commonly generates two versions of the loop: vectorized and scalar.  The scalar loop is necessary to handle the case where the trip count isn't evenly divisible by the vectorization factor.  Therefore, it's reasonable to disable these type of optimizations (e.g., vectorization, unrolling) when we're optimizing for size.  It's also reasonable to disable these optimizations at -O0.

However, I also understand the argument being made by Chandler.  Can you please create an LLVM patch the shows the loop unroll pass respects the equivalent -Os/-Oz/-O0 in LLVM IR?

I believe the first two are handled by checking Function::optForSize() and for the latter you can check the function for the optnone attribute.


Repository:
  rL LLVM

http://reviews.llvm.org/D19827





More information about the cfe-commits mailing list