[LLVMdev] Bitcast to [0 x Type]*

Duncan Sands baldrick at free.fr
Thu Nov 11 23:57:55 PST 2010

Hi Arushi,

> I see many statements like the one following, with casts to a 0-sized array.
>   %10 = getelementptr inbounds [0 x %struct.Link]* bitcast ([497 x
> %struct.Link]* @link_array to [0 x %struct.Link]*), i64 0, i64 %9 ;
> <%struct.Link*> [#uses=1]
> Why does this happen, and which  transform causes this?

I don't think any transform generates such bitcasts.  They are probably coming
from the original code: variable length arrays are usually represented by
[0 x element_type].



More information about the llvm-dev mailing list