Struct types may have leading zero-length elements like [0 x i32], in which case the "real" element at offset 0 will not necessarily coincide with the 0th element of the aggregate. ConstantFoldLoadThroughBitcast() wants to drill down the element at offset 0, but currently always picks the 0th aggregate element to do so. This patch changes the code to find the first non-zero-length element instead.
The motivation behind this change is https://github.com/rust-lang/rust/issues/48627. Rust is fond of emitting [0 x iN] separators between struct elements to enforce alignment, which prevents constant folding in this particular case.
This is probably an infinite loop on something like [4294967296 x [0 x i32]]. (An LLVM array can have up to 2^64 elements.) Not sure how much we care... it looks like there are overflows like this all over the place in LLVM.
Otherwise looks fine.