<div dir="ltr">Hi,
<div>I have a question regarding pointer aliasing.</div>
<div>I have following C code:</div>
<blockquote style="MARGIN-RIGHT: 0px">
<div>void factorial(float **a, float **b)</div>
<div>{</div>
<div> b[2][2] = a[0][2];</div>
<div> b[2][2] = a[0][1];</div>
<div>}</div></blockquote>
<div> </div>
<div>Which is converted to following LLVM IR:</div>
<blockquote style="MARGIN-RIGHT: 0px">
<div>define void @factorial(float** nocapture %a, float** nocapture %b) nounwind {</div>
<div>entry:</div>
<div> %0 = getelementptr inbounds float** %b, i64 2 ; <float**> [#uses=2]</div>
<div> %1 = load float** %0, align 8 ; <float*> [#uses=1]</div>
<div> %2 = load float** %a, align 8 ; <float*> [#uses=1]</div>
<div> %3 = getelementptr inbounds float* %2, i64 2 ; <float*> [#uses=1]</div>
<div> %4 = load float* %3, align 4 ; <float> [#uses=1]</div>
<div> %5 = getelementptr inbounds float* %1, i64 2 ; <float*> [#uses=1]</div>
<div> store float %4, float* %5, align 4</div>
<div> %6 = load float** %0, align 8 ; <float*> [#uses=1]</div>
<div> %7 = load float** %a, align 8 ; <float*> [#uses=1]</div>
<div> %8 = getelementptr inbounds float* %7, i64 1 ; <float*> [#uses=1]</div>
<div> %9 = load float* %8, align 4 ; <float> [#uses=1]</div>
<div> %10 = getelementptr inbounds float* %6, i64 2 ; <float*> [#uses=1]</div>
<div> store float %9, float* %10, align 4</div>
<div> ret void</div>
<div>}</div></blockquote>
<div> </div>
<div>Assuming that a and b arrays contains pointers that are not aliased,</div>
<div>is it possible to remove the first store by using some C or LLVM IR specific declarations?</div>
<div> </div>
<div>Thanks.</div>
<div clear="all"> </div>
<div>-- </div>
<div>Artiom</div>
<div> </div></div>