Rename SeparateConstOffsetFromGEP pass to ReassociateGEPs and
expand to include reassociation of loop invariant terms in the
indices of GEPs. This reassociation enables splitting GEPs into
two separate GEPS: one loop invariant and the other loop variant
GEPs. The existing reassociation pass is unable to perform this
transformation because that pass does not reassociate values
across GEP operands.
The renamed pass now performs three related GEP transformations:
- Reassociate and gather constant offsets in GEP sequential index operands.
- Reassociate loop invariant terms in GEP sequential index operands.
- (Optional) Lower GEPs into simpler GEPs or their arithmetic equivalents.
This patch adds (2) and includes significant refactoring to share
code between the constant offset reassociation and the loop