GEP's across basic blocks were not getting splitted due to EnableGEPOpt which was turned off by default. Hence, EarlyCSE missed the opportunity to eliminate common part of GEP's. This can be achieved by simply turning GEP pass on.
- This patch moves SeparateConstOffsetFromGEPPass() just before LSR().
- It enables EnableGEPOpt by default.
Resolves - https://github.com/llvm/llvm-project/issues/50528
Added an unit test.
Make this %v1, %v2, I think is better. One of the loads is otherwise unused.