Bug ID: 41106
           Summary: #pragma clang loop unroll(enable) has no limit for
                    fixed iteration loops
           Product: libraries
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Loop Optimizer

LLVM will unroll every fixed iteration loop entirely with the unroll(enable)
pragma, no matter how ridiculous it is. 

unsigned foo(const unsigned *x)
    unsigned acc = 0;
#pragma clang loop unroll(enable)
    for (int i = 0; i < 100; i++) {
        acc += *x++;
    return acc;

Stumbled upon this code.

Compile it with -O3. Clang will unroll this loop 100 times. Change it to 500
times, it will unroll it 500 times. Change it to 10000, it will unroll it 10000

How is that useful?

LLVM shouldn't take the unroll pragma so damn literally. Anything above 32-64
iterations is waaaaaaaaay too much, and that is what unroll_count should be
for, to override this limit.

You are receiving this mail because:
You are on the CC list for the bug.
llvm-bugs mailing list

Reply via email to