[llvm] [AMDGPU] Promote allocas used by phi/select (PR #221870)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 7 23:40:40 PDT 2026
================
@@ -280,6 +314,51 @@ bool AMDGPUPromoteAllocaImpl::collectAllocaUses(AllocaAnalysis &AA) const {
};
SmallVector<Instruction *, 4> WorkList({AA.Alloca});
+
+ // Classify the "other" operand of a pointer phi/select (i.e. an operand not
+ // derived from Cur). Returns false if the merge makes the alloca entirely
+ // unpromotable (merged with an unknown object). Otherwise records links to
+ // any other allocas (for grouping).
+ //
+ // The operand may itself be a chain of phis/selects (e.g. a phi of a phi), so
+ // we look through them to find the set of underlying root allocas. Visited
+ // guards against cyclic pointer phis.
+ SmallPtrSet<Value *, 8> Visited;
+ std::function<bool(Value *)> ClassifyMergeOperand = [&](Value *Other) -> bool {
----------------
arsenm wrote:
This is big enough to not be a lambda
https://github.com/llvm/llvm-project/pull/221870
More information about the llvm-commits
mailing list