-
Notifications
You must be signed in to change notification settings - Fork 5
Description
Hi,
after playing around with CHiLL for a bit, I noticed that it had optimized one of my programs even though I had made a copy&paste mistake.
Take a look at this example:
void foo(double* A, double* B) {
int y = 0;
int x = 0;
for (y = 0; x <= 20; y++) {
for (x = 1; x <= 10; y++) {
A[x] = B[y];
}
}
}The first loop has the condition x <= 20 even though it was meant to be y <= 20. But it seems that it makes no difference whether I write y or x. CHiLL always returns the same result. This is the unmodified code returned by CHiLL:
for(t2 = 0; t2 <= 20; t2++) {
for(t4 = 1; t4 <= 10; t4++) {
s0(t2,t4);
}
}I even took it a bit further and added another variable:
void foo(double* A, double* B) {
int y = 0;
int x = 0;
int t = 0;
for (y = 0; t <= 20; y++) {
for (x = 1; x <= 10; y++) {
A[x] = B[y];
}
t+=2;
}
}While the transformation yields a different loop, the condition remains the same as in the previous example.
I don't expect CHiLL to handle the second example but it would be great if we got some kind of warning or error. :-)
Btw, this is my loop.script.py:
Click to expand
from chill import *
source('./loop.cpp')
destination('loop_modified.cpp')
procedure('foo')
loop(0)
original()
print_dep()
print_code()
skew([0], 2, [1,1])
print_dep()
print_code()
permute([2,1])
print_dep()
print_code()PS: I read http://ctop.cs.utah.edu/ctop/wp-content/uploads/2017/03/CHiLL.pdf but couldn't find anything regarding restriction of the (for-) loop condition. Am I missing something? :-)
Regards,
Andre