[llvm] [SROA] Allow unfolding gep(phi(gep,gep)) (PR #178126)

Theodoros Theodoridis via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 2 02:16:16 PST 2026


================
@@ -4518,6 +4522,16 @@ class AggLoadStoreRewriter : public InstVisitor<AggLoadStoreRewriter, bool> {
         NewGEP = NewPhi->getIncomingValue(NI);
       } else {
         SmallVector<Value *> NewOps = GetNewOps(Op);
+
+        // For arguments, constants, and static allocas, we insert GEPs at the
+        // end of the entry block. For GEP incoming values, we insert right
+        // after the GEP to ensure proper dominance.
+        if (auto *OpGEP = dyn_cast<GetElementPtrInst>(NewOps[0])) {
----------------
thetheodor wrote:

What would be the intension of this change? Changing the type to instruction would also change the placement when handling static allocas (which are currently placed near the terminator). 

https://github.com/llvm/llvm-project/pull/178126


More information about the llvm-commits mailing list