-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LICM missing hoist of calls due to missing loop rotation #1526
Comments
This should be straight-forward to implement when the LoopPassMgr stuff comes up. |
We now have a LoopPassManager and a LoopRotation pass. Is this now fixed or is |
Loop rotation isn't on by default yet. Devang, please use this as a testcase when it goes in. -Chris |
ok |
This is fixed. How do I write a test case ? |
Isn't the test case in the first comment in this bug sufficient? |
No :) I verified CFG. My question is : How to write dejagnu test ? |
I'd suggest using prcontext like test/Transforms/LICM/sink_inst.ll does. This will allow you to grep for Thanks Devang! -Chris |
Thanks! |
Extended Description
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
The text was updated successfully, but these errors were encountered: