http://llvm.org/bugs/show_bug.cgi?id=20058

            Bug ID: 20058
           Summary: High loop unroll counts can result in long compile
                    times
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

Compilation can take a long time with high loop counts and is looks to be
quadratic with loop count.  The addition of loop unroll pragmas
(http://reviews.llvm.org/D4147, not yet submitted) will make it more likely
that users will encounter this bad behavior.

Attached is the IR from the following simple C code:

void loop(int *a)
{
  for (int i = 0; i < 1000000; i++) {
    a[i]++;
  }
}

I measured ~2s to unroll this loop 16K times with release build at head, ~10s
to unroll roll it 32K times, and ~50s for 64K, so it appears to be growing (at
least) quadratically.  Profiling suggests time is being taken in somewhere
beneath llvm::UnrollLoop -> FoldBlockIntoPredecessor ->
llvm::ScalarEvolution::forgetLoop.

Run:
opt loop.ll -loop-rotate -loop-unroll -unroll-count 16000 -unroll-allow-partial
-unroll-threshold=10000000

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to