[LLVMbugs] [Bug 1154] NEW: LICM missing hoist of calls do to missing loop rotation
bugzilla-daemon at cs.uiuc.edu
bugzilla-daemon at cs.uiuc.edu
Wed Jan 31 20:14:01 PST 2007
http://llvm.org/bugs/show_bug.cgi?id=1154
Summary: LICM missing hoist of calls do to missing loop rotation
Product: libraries
Version: trunk
Platform: Macintosh
OS/Version: MacOS X
Status: NEW
Severity: enhancement
Priority: P2
Component: Loop Optimizer
AssignedTo: unassignedbugs at nondot.org
ReportedBy: sabre at nondot.org
In this example code:
#include <stdlib.h>
#include <string.h>
#define TESTSTRING2 "Dot. date. datum. 123. Some more doubtful demonstration dummy data."
int stringSearch_Clib (long count) {
int i, c = 0;long j;char * p;
char b[sizeof(TESTSTRING2)];
strcpy (b, TESTSTRING2);
for (j=0; j < count; j++) {
for (c=i=0; i < 250; i++) {
if (NULL != (p = strstr (b, "ummy"))) c += (int) (p - b);
if (NULL != (p = strstr (b, " data"))) c += (int) (p - b);
c += (int) strcspn (b, "by");
}
}
return c;
}
The calls to strstr and strcspn are loop invariant and should be hoisted. They aren't though, because
the inner loop isn't getting rotated. This can easily be seen with:
$ llvm-gcc t.c -emit-llvm -O3 -o - -S | llvm-as | opt -print-cfg
and then viewing cfg.stringSearch_Clib.dot.
-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