[llvm-bugs] [Bug 41106] New: #pragma clang loop unroll(enable) has no limit for fixed iteration loops
via llvm-bugs
llvm-bugs at lists.llvm.org
Sat Mar 16 23:33:39 PDT 2019
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: unassignedbugs at nondot.org
Reporter: husseydevin at gmail.com
CC: llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190317/e5742d55/attachment.html>
More information about the llvm-bugs
mailing list