<html><body><div style="color:#000; background-color:#fff; font-family:arial, helvetica, sans-serif;font-size:10pt"><div>Hello,</div><div><br></div><div>How can I compute the functions on the loop iterators used as array indices? </div><div><br></div><div>For example:</div><div><br></div><div>for i = 0, N</div><div> for j = 0, M</div><div><span class="tab"> </span><span class="tab"> </span><span class="tab"> A[2*i + j - 10] = ... </span></div><div><br><span class="tab"></span></div><div><span class="tab">Can I obtain that this instruction </span><span class="tab">A[2*i + j - 10]= .. always accesses memory using a function f(i,j) = 2*i + j - 10 + base_address_of_A</span></div><div><br><span class="tab"></span></div><div><span class="tab">If I run the scalar evolution pass on this code I obtain:</span></div><div><span
class="tab"><br></span></div><div><span class="tab">%arrayidx = getelementptr inbounds [200 x i32]* @main.A, i32 0, i64 %idxprom</span></div><div><span class="tab"><br></span></div><div><span class="tab"> --> ((4 * (sext i32 (-10 + (2 * %tmp6) + %tmp7) to i64)) + @main.A) </span></div><div><br><span class="tab"></span></div><div><span class="tab">Could you please offer an insight on how can I obtain the function from the internals of the scalar evolution pass? </span></div><div><span class="tab">Thank you.<br></span></div><div><br><span class="tab"></span></div><div><span class="tab">Alexandra<br></span></div></div></body></html>