[LLVMdev] array index type shuffling in GEPs

Jon McLachlan mclachlan at apple.com
Mon Nov 2 15:30:31 PST 2009


Hey folks,

   I am hoping that someone might be able to help me better understand  
this design decision:  For a 64 bit target, index's into GEP's of  
arrays are zext up to 64 bit integers, even if the variable itself is  
an alloca of only i32.  Similarly, on a 32 bit target, index's into  
GEP's are trunc'd down to 32 bits even if they ultimately reference an  
alloc'd variable of type i64.

   My guess is that in the latter, there is a 2^32 limit on the number  
of elements in an array for 32 bit systems.  This doesn't make sense  
for the former, though, since we're casting up to 64 bits from the  
smaller 32.  So,  does anyone have any insight, comments, or thoughts  
on why we're zext up to 64 bit representation?

Take Care,
~Jon



More information about the llvm-dev mailing list