bwendling wrote: > > For unions, clang will use the type of the union member with the largest > > size as the alloca type, regardless of which union member is active. I > > haven't tried, but your patch will probably compute the subobject size > > based on that arbitrarily picked member, rather than the one being accessed. > > Another concrete case where using the IR type won't work is arrays whose > initializer is mostly-zeroes. For example, for > > ``` > int arr[20] = {[5] = 6}; > ``` > > we give `arr` the IR type `<{ i32, i32, i32, i32, i32, i32, [14 x i32] }>` so > that we can use a `zeroinitializer` to fill the trailing portion of the array.
My patch only works with structs. https://github.com/llvm/llvm-project/pull/78526 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits