<div dir="ltr"><div><div><div><div><div><div><div><div><div>Look at it from a "C" perspective. <br><br></div>If you have `int **`, and want `intx4 *`, what do you need to do?<br><br></div>You will need to load (copy, read) the content of the pointer.<br></div>But it's the wrong type, you only get a single `int` that way. So you need to cast the pointer to `intx4 **` first.<br><br></div>So, in essence:<br></div><div>    int **p;<br>    ... <br></div>    auto tmp = (intx4**)p;    // Bitcast<br></div>    intx4 val = *tmp;            // Load<br><br></div>In IR, that becomes a bitcast and load instruction. <br><br></div>If you also want to do tmp[3] or some such, there would be a GEP instruction after the bitcast.<br><br>--<br></div>Mats<br></div><div class="gmail_extra"><br><div class="gmail_quote">On 12 August 2017 at 15:40, Krzysztof Parzyszek via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 8/12/2017 9:32 AM, Tim Northover wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 12 August 2017 at 04:13, Siddharth Bhat via llvm-dev<br>
<<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
What would the "correct form of GEP be"?<br>
</blockquote>
<br>
I don't think there is one. The types are not compatible. In your<br>
situation i32** is an array of N pointers to i32 arrays. [4 x i32]* is<br>
a contiguous array of 4N i32s.<br>
<br>
If you really need to use a function that takes the second type then<br>
copying the data is the only option I see.<br>
</blockquote>
<br></span>
Ah, right.  I was assuming that OP wanted to load pointers instead of i32s.<br>
<br>
-Krzysztof<div class="HOEnZb"><div class="h5"><br>
______________________________<wbr>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
</div></div></blockquote></div><br></div>