[llvm-bugs] [Bug 43840] New: Loop peeling is errneously not performed - only considers inequality predicates
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Oct 29 11:45:57 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=43840
Bug ID: 43840
Summary: Loop peeling is errneously not performed - only
considers inequality predicates
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Loop Optimizer
Assignee: unassignedbugs at nondot.org
Reporter: lebedev.ri at gmail.com
CC: llvm-bugs at lists.llvm.org
Trivial example:
void init();
void sink();
void bad(int len) {
for(int i = 0; i < len; i++) {
if(i == 0) {
init();
}
sink();
}
}
It would make sense to peel the first iteration, so we no longer have
the always-false condition for the rest of the loop.
But the peeling does not happen!
https://godbolt.org/z/Y_wBgM
It does happen if *two* iterations should be peeled:
https://godbolt.org/z/RTf_QS
This appears to be an oversight: it only considers inequality comparisons,
it does not know how to deal with equality comparisons:
https://godbolt.org/z/1xmCKx
--
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/20191029/2d601ffc/attachment.html>
More information about the llvm-bugs
mailing list