diff options
author | Andrew Trick <atrick@apple.com> | 2011-12-16 02:03:48 +0000 |
---|---|---|
committer | Andrew Trick <atrick@apple.com> | 2011-12-16 02:03:48 +0000 |
commit | 1da282764aa8f155973769b44e4d5e67a0420af9 (patch) | |
tree | 37ff15a4b7a5d52d199023bb81e8240aae7f4e1e /lib/Transforms/Utils/LoopUnroll.cpp | |
parent | 478a4d997ac4f0b3286e2ab0d4b445aff3cf2448 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146721 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Utils/LoopUnroll.cpp')
-rw-r--r-- | lib/Transforms/Utils/LoopUnroll.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Transforms/Utils/LoopUnroll.cpp b/lib/Transforms/Utils/LoopUnroll.cpp index b96f14b144..512b689501 100644 --- a/lib/Transforms/Utils/LoopUnroll.cpp +++ b/lib/Transforms/Utils/LoopUnroll.cpp @@ -176,6 +176,11 @@ bool llvm::UnrollLoop(Loop *L, unsigned Count, unsigned TripCount, 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); |