[llvm] r285330 - [LoopUnroll] Check partial unrolling is enabled before initialization. NFC.

Haicheng Wu via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 27 11:40:02 PDT 2016


Author: haicheng
Date: Thu Oct 27 13:40:02 2016
New Revision: 285330

URL: http://llvm.org/viewvc/llvm-project?rev=285330&view=rev
Log:
[LoopUnroll] Check partial unrolling is enabled before initialization. NFC.

Differential Revision: https://reviews.llvm.org/D23891

Modified:
    llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp?rev=285330&r1=285329&r2=285330&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp Thu Oct 27 13:40:02 2016
@@ -803,8 +803,6 @@ static bool computeUnrollCount(
   // 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 "
@@ -812,6 +810,8 @@ static bool computeUnrollCount(
       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;




More information about the llvm-commits mailing list