[PATCH] D27911: [LoopUnroll] Keep UP.Count when considering complete unroll

Z. Zheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 18 19:20:54 PST 2016

zzheng created this revision.
zzheng added reviewers: evstupac, mzolotukhin, zinob.
zzheng added a subscriber: llvm-commits.
zzheng set the repository for this revision to rL LLVM.

r286389 updates UP.Count unconditionally when considering complete unroll of loop with compile-time known TripCount.
This can overwrite UP.Count retrieved by getUnrollingPreferences().




Index: lib/Transforms/Scalar/LoopUnrollPass.cpp
--- lib/Transforms/Scalar/LoopUnrollPass.cpp
+++ lib/Transforms/Scalar/LoopUnrollPass.cpp
@@ -782,7 +782,7 @@
   assert((ExactTripCount == 0 || MaxTripCount == 0) &&
          "ExtractTripCound and MaxTripCount cannot both be non zero.");
   unsigned FullUnrollTripCount = ExactTripCount ? ExactTripCount : MaxTripCount;
-  UP.Count = FullUnrollTripCount;
+  UP.Count = UP.Count ? UP.Count : FullUnrollTripCount;
   if (FullUnrollTripCount && FullUnrollTripCount <= UP.FullUnrollMaxCount) {
     // When computing the unrolled size, note that BEInsns are not replicated
     // like the rest of the loop body.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27911.81912.patch
Type: text/x-patch
Size: 726 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161219/af858853/attachment.bin>

More information about the llvm-commits mailing list