[LoopUnrollRuntime] Clean up a predicate.

Clean up a predicate I added in r229731, fix the relevant comment and
add a test case.  The earlier version is confusing to read and was also
buggy (probably not a coincidence) till Alexey fixed it in r233881.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234701 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Sanjoy Das
2015-04-12 01:24:01 +00:00
parent e2e641234f
commit e0f4a11a89
2 changed files with 47 additions and 3 deletions

View File

@@ -318,9 +318,8 @@ bool llvm::UnrollRuntimeLoopProlog(Loop *L, unsigned Count, LoopInfo *LI,
return false;
// This constraint lets us deal with an overflowing trip count easily; see the
// comment on ModVal below. This check is equivalent to `Log2(Count) <
// BEWidth`.
if (BEWidth < 64 && static_cast<uint64_t>(Count) > (1ULL << BEWidth))
// comment on ModVal below.
if (Log2_32(Count) > BEWidth)
return false;
// If this loop is nested, then the loop unroller changes the code in