This is an archive of the discontinued LLVM Phabricator instance.

[LV][VPlan] Refactor VPReductionRecipe to use reference for member RdxDesc
ClosedPublic

Authored by Mel-Chen on Aug 16 2023, 1:57 AM.

Details

Summary

This commit refactors the implementation of VPReductionRecipe to use
reference instead of pointer for member RdxDesc. Because the member
RdxDesc in VPReductionRecipe should not be a nullptr, using a reference
will provide clearer semantics.

Diff Detail

Event Timeline

Mel-Chen created this revision.Aug 16 2023, 1:57 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 16 2023, 1:57 AM
Mel-Chen requested review of this revision.Aug 16 2023, 1:57 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 16 2023, 1:57 AM
fhahn accepted this revision.Aug 16 2023, 3:20 AM

LGTM, thanks!

It looks like there are some clang-format errors according to the precommit tests, please make sure to run clang-format-diff before landing.

llvm/lib/Transforms/Vectorize/VPlan.h
1732

Should this also be reference?

This revision is now accepted and ready to land.Aug 16 2023, 3:20 AM
Mel-Chen updated this revision to Diff 550737.Aug 16 2023, 6:53 AM

Thanks for Florian's reminder!
Rebase and clang-format it again.

Mel-Chen added inline comments.Aug 16 2023, 7:00 AM
llvm/lib/Transforms/Vectorize/VPlan.h
1732

Good question! I just verified, and it seems that TTI in llvm::createTargetReduction is not being used. Perhaps we can directly remove TTI from VPReductionRecipe.