[llvm] [VPlan] Handle regions with live-outs and scalar VF when replicating. (PR #186252)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 29 08:35:14 PDT 2026
================
@@ -1637,7 +1637,11 @@ void VPPhi::execute(VPTransformState &State) {
PHINode *NewPhi = State.Builder.CreatePHI(
State.TypeAnalysis.inferScalarType(this), 2, getName());
unsigned NumIncoming = getNumIncoming();
- if (getParent() != getParent()->getPlan()->getScalarPreheader()) {
+ // Detect header phis: the parent block dominates its second incoming block
+ // (the latch). Non-header phis, e.g. from dissolved replicate regions, don't
+ // have this property.
----------------
ayalz wrote:
In any case VPPhi::execute can and should hook up to already visited incomings only, and clamping NumIncoming from 2 to 1 is a way to skip all (the) other incomings. I.e., comment can stay, just w/o the TODO, and join the above comment that clarifies how header blocks are detected (i.e., in the natural way - dominates a predecessor).
https://github.com/llvm/llvm-project/pull/186252
More information about the llvm-commits
mailing list