https://bugs.llvm.org/show_bug.cgi?id=41106
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
Assignee: unassignedb...@nondot.org
Reporter: husseyde...@gmail.com
CC: llvm-bugs@lists.llvm.org
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
times.
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
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs