[llvm] [llvm] Fix crash when complex deinterleaving operates on an unrolled loop (PR #129735)
Nicholas Guy via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 14 08:46:31 PDT 2025
================
@@ -2253,8 +2261,31 @@ void ComplexDeinterleavingGraph::processReductionSingle(
auto *FinalReduction = ReductionInfo[Real].second;
Builder.SetInsertPoint(&*FinalReduction->getParent()->getFirstInsertionPt());
- auto *AddReduce = Builder.CreateAddReduce(OperationReplacement);
+ Value *Other;
+ bool EraseFinalReductionHere = false;
+ if (match(FinalReduction, m_c_Add(m_Specific(Real), m_Value(Other)))) {
----------------
NickGuy-Arm wrote:
I think this is a separate issue; I wouldn't expect that snippet to be processed as the current implementation would require changing the function return type. Whereas the issue this patch is aimed at fixing is when it tries to change one operand of an add with a value of a different type.
If this were to instead reinterleave and store the complex result in `middle.block`, instead of returning it, then I would expect the pass to process it and emit `cdot` instructions.
> When I replace the add in this test, by a sub, the pass still crashes, so this is not sufficient.
I'm not sure if the loop vectorizer would ever emit a sub here. Please do correct me if I'm wrong, but I'm not seeing any `VECREDUCE_ADD` or `vecreduce.add` equivalent for subtraction, and the instruction of `%bin.rdx` in this case is derived from the reduction intrinsic.
https://github.com/llvm/llvm-project/pull/129735
More information about the llvm-commits
mailing list