[LLVMdev] About Scalar Evolution Pass and SCEVAddRecExpr

ihcinihsdk ali28 at wisc.edu
Wed Apr 25 02:16:57 PDT 2012


Hi,
I wonder how many of you are familiar with scalar evolution pass. I met a
problem regarding to the SCEVAddRecExpr. Say for the code:
const int N = 100;
int a[N];
for(int i=0;i<N;i++) a[i] = 0;
For the access of a[i], the pass will transform this a[i] to a
SCEVAddRecExpr <@a, +, sizeof(int)><BB_Name>, which means the access of the
array `a' starts from the address `a' and has an access stride of
`sizeof(int)'.
However, when this code is slightly modified:

const int N=100;
int a[N];
int i;
for(i=0;i<N-1; i++) {}
a[i] = 0;

So the loop is empty and there's an access of `a[i]' (actually a[99] in this
case), this a[i] will still be transformed into the same SCEVAddRecExpr as
above. This does not really seem to make sense to me because the access
pattern is not really so at all. Is is a small bug in this tool? Thank you!
-- 
View this message in context: http://old.nabble.com/About-Scalar-Evolution-Pass-and-SCEVAddRecExpr-tp33745284p33745284.html
Sent from the LLVM - Dev mailing list archive at Nabble.com.




More information about the llvm-dev mailing list