[llvm] [SROA] Unfold gep of index phi (round 2) (PR #83494)
Arthur Eubanks via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 29 15:58:27 PST 2024
aeubanks wrote:
> Q: why not put those GEPs into appropriate incoming basic blocks. That would be a smaller-scope unfolding. I suspect those geps will be sunk into appropriate basic blocks, but it may be better if we don't have to do that.
It doesn't really matter where the GEP is, later optimizations will place them wherever optimal.
If we want to support this unfolding for GEPs on top of allocas/constants/args, it's trickier
```
bb1:
bb2:
bb3:
%i = phi [ 4, %bb1 ], [ 8, %bb2 ]
%g1 = gep ...
%g2 = gep %g1, %i
```
can't become
```
bb1:
%g_bb1 = gep %g1, 4
bb2:
%g_bb2 = gep %g1, 8
bb3:
%g2 = phi [ %g_bb1, %bb1 ], [ %g_bb2, %bb2 ]
%g1 = gep ...
```
since `%g1` is defined later than its uses. So I've been trying to keep the insertion point simple.
https://github.com/llvm/llvm-project/pull/83494
More information about the llvm-commits
mailing list