[llvm] [LV] Fix miscompile with conditional scalar assignment + tail folding (PR #182492)
Sander de Smalen via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 24 02:26:08 PST 2026
================
@@ -1381,11 +1391,23 @@ bool VPlanTransforms::handleFindLastReductions(VPlan &Plan) {
return NumIncomingDataValues == 1;
};
+ VPSingleDefRecipe *SelectR =
+ cast<VPSingleDefRecipe>(CondSelect->getDefiningRecipe());
if (!match(SelectR,
m_Select(m_VPValue(Cond), m_VPValue(Op1), m_VPValue(Op2))) &&
!MatchBlend(SelectR))
return false;
+ assert(Cond != HeaderMask && "Cond must not be HeaderMask");
+
+ // Find final reduction computation and replace it with an
+ // extract.last.active intrinsic.
+ auto *RdxResult =
+ vputils::findUserOf<VPInstruction::ComputeReductionResult>(
+ BackedgeSelect);
+ if (!RdxResult)
+ return false;
----------------
sdesmalen-arm wrote:
Should this actually be an assert that `RdxResult` is non-zero?
https://github.com/llvm/llvm-project/pull/182492
More information about the llvm-commits
mailing list