Fold loadInst for constant aggregate types, those load results are equivalent for the given alignments.
This revision will be part 1 of the following stages.
- alignment-based (This revision will be)
- GEP-based https://reviews.llvm.org/D146622
- add ConstantFoldLoadFromPatternedAggregate method to AggressiveInstCombine
alive proofs: https://alive2.llvm.org/ce/z/qBGl72
Depends on: https://reviews.llvm.org/D145355
Fixes: https://github.com/rust-lang/rust/issues/107208.
What you need maybe something like Constant::getSplatValue with proper handle with constant struct and array