This is an archive of the discontinued LLVM Phabricator instance.

[LoopVectorize] Ensure the VPReductionRecipe is placed after all it's inputs
ClosedPublic

Authored by david-arm on Jul 12 2022, 2:36 AM.

Details

Summary

When vectorising ordered reductions we call a function
LoopVectorizationPlanner::adjustRecipesForReductions to replace the
existing VPWidenRecipe for the fadd instruction with a new
VPReductionRecipe. We attempt to insert the new recipe in the same
place, but this is wrong because createBlockInMask may have
generated new recipes that VPReductionRecipe now depends upon. I
have changed the insertion code to append the recipe to the
VPBasicBlock instead.

Added a new RUN with tail-folding enabled to the existing test:

Transforms/LoopVectorize/AArch64/scalable-strict-fadd.ll

Diff Detail

Event Timeline

david-arm created this revision.Jul 12 2022, 2:36 AM
david-arm requested review of this revision.Jul 12 2022, 2:36 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 12 2022, 2:36 AM
kmclaughlin added inline comments.Jul 12 2022, 6:28 AM
llvm/test/Transforms/LoopVectorize/AArch64/scalable-strict-fadd.ll
26

I think the new check lines from for.end here and in the other tests below can be removed, since we will never reach the scalar epilogue?

david-arm updated this revision to Diff 443944.Jul 12 2022, 7:55 AM
  • Removed pointless CHECK lines in fadd_strict_interleave for for.end and ret
david-arm marked an inline comment as done.Jul 12 2022, 8:00 AM
david-arm added inline comments.
llvm/test/Transforms/LoopVectorize/AArch64/scalable-strict-fadd.ll
26

I've left in most of them because I think the other CHECK lines want to show the reduction value being returned from the function. However, I did remove them from fadd_strict_interleave as they didn't add any value.

kmclaughlin accepted this revision.Jul 12 2022, 8:02 AM

Thank you @david-arm, this LGTM

This revision is now accepted and ready to land.Jul 12 2022, 8:02 AM
This revision was landed with ongoing or failed builds.Jul 13 2022, 1:29 AM
This revision was automatically updated to reflect the committed changes.
david-arm marked an inline comment as done.