[llvm-commits] [llvm] r146721 - /llvm/trunk/lib/Transforms/Utils/LoopUnroll.cpp

Andrew Trick atrick at apple.com
Thu Dec 15 18:03:48 PST 2011


Author: atrick
Date: Thu Dec 15 20:03:48 2011
New Revision: 146721

URL: http://llvm.org/viewvc/llvm-project?rev=146721&view=rev
Log:
Avoid a confusing assert for silly options: -unroll-runtime -unroll-count=1.

No need for an explicit test case for an unsupported combination of options.

Modified:
    llvm/trunk/lib/Transforms/Utils/LoopUnroll.cpp

Modified: llvm/trunk/lib/Transforms/Utils/LoopUnroll.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/LoopUnroll.cpp?rev=146721&r1=146720&r2=146721&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/LoopUnroll.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/LoopUnroll.cpp Thu Dec 15 20:03:48 2011
@@ -176,6 +176,11 @@
   if (TripCount != 0 && Count > TripCount)
     Count = TripCount;
 
+  // Don't enter the unroll code if there is nothing to do. This way we don't
+  // need to support "partial unrolling by 1".
+  if (TripCount == 0 && Count < 2)
+    return false;
+
   assert(Count > 0);
   assert(TripMultiple > 0);
   assert(TripCount == 0 || TripCount % TripMultiple == 0);





More information about the llvm-commits mailing list