This is an archive of the discontinued LLVM Phabricator instance.

[VPlan] Add VPWidenCastRecipe, split off from VPWidenRecipe (NFCI).
ClosedPublic

Authored by fhahn on Apr 24 2023, 10:32 AM.

Details

Summary

To generate cast instructions, the result type is needed. To allow
creating widened casts without underlying instruction, introduce a new
VPWidenCastRecipe that also holds the result type.

This functionality will be used in a follow-up patch to
implement truncateToMinimalBitwidths as VPlan-to-VPlan transform.

Diff Detail

Event Timeline

fhahn created this revision.Apr 24 2023, 10:32 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 24 2023, 10:32 AM
fhahn requested review of this revision.Apr 24 2023, 10:32 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 24 2023, 10:32 AM
Ayal accepted this revision.May 3 2023, 2:16 PM

LGTM, trying to keep all them recipes in order ... worth adding VPlan-print tests?

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
8680

nit (Independent of this patch, mentioned before): VPRecipeOrVPValueTy should be cleaned up and removed.

llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
57–65
91–99
128–139
715

Is this (or the original) Widen recipe built also for scalar VF? (Independent of this patch)

730

nit: worth printing WIDEN CAST? Differs from WIDEN by the "to" result type anyhow.

No current VPlan-printing tests are affected? Should be added?

llvm/lib/Transforms/Vectorize/VPlanValue.h
349–352
This revision is now accepted and ready to land.May 3 2023, 2:16 PM
fhahn marked 6 inline comments as done.May 4 2023, 1:44 PM
fhahn added inline comments.
llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
57–65

Existing order fixed in 1b05e7498224

91–99

Existing order fixed in 1b05e7498224

128–139

Existing order fixed in 1b05e7498224

715

No, will replace this with an assert in the original code.

730

Adjusted. There are already existing tests which show the change now

fhahn updated this revision to Diff 519635.May 4 2023, 1:44 PM
fhahn marked 5 inline comments as done.

Rebase and address remaining comments, thansk!

fhahn marked an inline comment as done.May 4 2023, 1:44 PM
fhahn added inline comments.
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
8680

ACK!

fhahn updated this revision to Diff 519813.May 5 2023, 5:17 AM
fhahn marked an inline comment as done.

Reabse, I am planning to land this soon.

This revision was landed with ongoing or failed builds.May 5 2023, 5:20 AM
This revision was automatically updated to reflect the committed changes.