[llvm-bugs] [Bug 28969] New: Loop not optimized away
via llvm-bugs
llvm-bugs at lists.llvm.org
Sat Aug 13 10:36:37 PDT 2016
https://llvm.org/bugs/show_bug.cgi?id=28969
Bug ID: 28969
Summary: Loop not optimized away
Product: libraries
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: Loop Optimizer
Assignee: unassignedbugs at nondot.org
Reporter: jmuizelaar at mozilla.com
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
Compiling this code with clang with -Oz gives
void m();
void l(unsigned int r) {
for (unsigned int x = 0, q = 0; x<r; x++, q++) {
if (q == r) {
m();
}
}
}
(__TEXT,__text) section
_l:
pushq %rbp
movq %rsp, %rbp
leal 0x1(%rdi), %eax
xorl %ecx, %ecx
movl %eax, %edx
andl $0x7, %edx
je 0x18
xorl %ecx, %ecx
incl %ecx
cmpl %ecx, %edx
jne 0x12
cmpl $0x7, %edi
jb 0x24
subl %ecx, %eax
addl $-0x8, %eax
jne 0x1f
popq %rbp
retq
changing:
if (q == r) {
to:
if (x == r) {
allows clang to successfully optimize the function away.
gcc optimizes the function away without any changes.
--
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/20160813/e04ba87c/attachment.html>
More information about the llvm-bugs
mailing list