Skip to content

Commit

Permalink
[LoopUnroll] Check partial unrolling is enabled before initialization…
Browse files Browse the repository at this point in the history
…. NFC.

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

llvm-svn: 285330
  • Loading branch information
Haicheng Wu committed Oct 27, 2016
1 parent d23219b commit 430b3e4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
Expand Up @@ -803,15 +803,15 @@ 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 "
<< "-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;
Expand Down

0 comments on commit 430b3e4

Please sign in to comment.