[LLVMbugs] [Bug 964] NEW: switch lowering makes ugly code for a simple scanning loop
bugzilla-daemon at cs.uiuc.edu
bugzilla-daemon at cs.uiuc.edu
Sun Oct 22 12:07:07 PDT 2006
http://llvm.org/bugs/show_bug.cgi?id=964
Summary: switch lowering makes ugly code for a simple scanning
loop
Product: libraries
Version: 1.8
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: Common Code Generator Code
AssignedTo: unassignedbugs at nondot.org
ReportedBy: sabre at nondot.org
Consider this function (very similar to strhr):
void foo(unsigned char C);
const char *FindChar(const char *CurPtr) {
unsigned char C;
do
C = *CurPtr++;
while (C != 'x' && C != '\0');
foo(C);
return CurPtr;
}
We currently compile the loop to:
LBB1_1: #bb
movb (%esi), %al
incl %esi
cmpb $119, %al
jg LBB1_4 #bb
LBB1_3: #bb
testb %al, %al
je LBB1_2 #bb7
jmp LBB1_1 #bb
LBB1_4: #bb
cmpb $120, %al
jne LBB1_1 #bb
It seems that switch lowering could produce something like:
cmpb $120, %al
je out
testb %al, %al
jnz LBB1_1 #bb7
which would be much faster.
-Chris
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
More information about the llvm-bugs
mailing list