Suppose we have
@_ZL9aPosition = internal addrspace(2) global [1 x <3 x float>] zeroinitializer, align 16
and global_var_init function does
store <4 x float> <float 4.000000e+00, float 4.000000e+00, float 4.000000e+00, float undef>, <4 x float> addrspace(2)* bitcast ([1 x <3 x float>] addrspace(2)* @_ZL9aPosition to <4 x float> addrspace(2)*), !tbaa !7
We can optimize this init function away by checking if the store has trailing undefs and if the types become compatible by shrinking the stores.
Looking forward to your feedback.
auto *