[PATCH] D23891: [LoopUnroll] Check partial unrolling is enabled before initialization. NFC.

Haicheng Wu via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 25 12:49:16 PDT 2016


haicheng created this revision.
haicheng added reviewers: mcrosier, mzolotukhin.
haicheng added a subscriber: llvm-commits.
haicheng set the repository for this revision to rL LLVM.
Herald added subscribers: mzolotukhin, mcrosier.

Check whether partial unrolling is enabled or not before initializing UP.Count for it.

Repository:
  rL LLVM

https://reviews.llvm.org/D23891

Files:
  lib/Transforms/Scalar/LoopUnrollPass.cpp

Index: lib/Transforms/Scalar/LoopUnrollPass.cpp
===================================================================
--- lib/Transforms/Scalar/LoopUnrollPass.cpp
+++ lib/Transforms/Scalar/LoopUnrollPass.cpp
@@ -779,15 +779,15 @@
   // 4rd priority is partial unrolling.
   // Try partial unroll only when TripCount could be staticaly calculated.
   if (TripCount) {
+    if (UP.Count == 0)
+      UP.Count = TripCount;
     UP.Partial |= ExplicitUnroll;
     if (!UP.Partial) {
       DEBUG(dbgs() << "  will not try to unroll partially because "
                    << "-unroll-allow-partial not given\n");
       UP.Count = 0;
       return false;
     }
-    if (UP.Count == 0)
-      UP.Count = TripCount;
     if (UP.PartialThreshold != NoThreshold) {
       // Reduce unroll count to be modulo of TripCount for partial unrolling.
       UnrolledSize = (uint64_t)(LoopSize - BEInsns) * UP.Count + BEInsns;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23891.69285.patch
Type: text/x-patch
Size: 910 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160825/0bb2a6be/attachment.bin>


More information about the llvm-commits mailing list