hi,<br><br>You could get it from the ScalarEvolution analysis(target data must available):<br>c code:<br>int f(int a[][4], int i, int j) {<br> return a[i][j];<br>}<br>llvm ir:<br>define i32 @f([4 x i32]* nocapture %a, i32 %i, i32 %j) nounwind readonly {<br>
entry:<br> %0 = sext i32 %i to i64 ; <i64> [#uses=1]<br>
%1 = sext i32 %j to i64 ; <i64> [#uses=1]<br> %2 = getelementptr inbounds [4 x i32]* %a, i64 %0, i64 %1 ; <i32*> [#uses=1]<br> %3 = load i32* %2, align 4 ; <i32> [#uses=1]<br>
ret i32 %3<br>}<br><br>SCEV expression of %2:<br>%2 = getelementptr inbounds [4 x i32]* %a, i64 %0, i64 %1 ; <i32*> [#uses=1]<br> --> ((4 * (sext i32 %j to i64)) + (16 * (sext i32 %i to i64)) + %a)<br><br><br>
--best regards<br>ether<br>