<div dir="ltr"><div>I have a global 2-D array ARRAY[N][M] and I am accessing it inside the for loop like this:</div><div><br></div><div>for (i...)</div><div>  for (j ...)</div><div>    ARRAY[i][j] ...</div><div><br></div><div>So nothing really weird is happening. If I look at the generated IR, it is also fairly straight forward.</div><div><br></div><div>@ARRAY0 = dso_local global [32 x [32 x i32]] zeroinitializer, section ".slow_mem", align 32, !dbg !84<br>...<br>%45 = getelementptr inbounds [32 x [32 x i32]], [32 x [32 x i32]]* @ARRAY0, i32 0, i32 %22, i32 7, !dbg !180<br>store volatile i32 %43, i32* %45, align 4, !dbg !181, !tbaa !148</div><div><br></div><div>As you can see, the 
GEPInst

exactly knows it is the ARRAY0, and it knows statically that it is accessing the 7th element.</div><div>However, when I try to call alias analysis in the LLVM pass, as in</div><div><br></div><div>AliasAnalysis *AA = ...<br></div><div>AA->alias(a, b)<br></div><div><br></div><div>where a is the ARRAY0 global variable and b is the GEPInst (%45), I only get mayAlias.</div><div>When reading the basicaa description, it seems like it should know that the two is must alias. What am I missing?</div><div><br></div><div>I did not know how I should post code in the thread, so I apologize for the messy format.<br></div><div>Thank you,</div><div>Best Regards,</div><div>Kiwan<br></div></div>