[llvm-dev] Use of array type in globals in LTO
Mehdi Amini via llvm-dev
llvm-dev at lists.llvm.org
Fri Aug 26 08:32:26 PDT 2016
> Recently, I noticed that less number of global variables are merged in global-merge pass and in some global variable, array types are used instead of its original type. For example, [4xi8] with align 4 is used for a i32 global variable. For me, it seems that such pattern is observed after r278338 (Resolution-based LTO API).
Are you sure it is performed in the global merge pass? Can you provide an example of input IR where you see this now but didn’t before?
Also can you confirm you’re using the gold-linker?
> Can anyone give me little bit more insight if such type change was intended? If then why such uses of array type is needed?
The transformation I know of is the common variables merging, bug it is not new. We use an array because we have to merge globals from different size and an array of bytes is the most straightforward representation for that.
More information about the llvm-dev