This is an archive of the discontinued LLVM Phabricator instance.

[LV] Check VPValue operand instead of Cost::isUniformAfterVec (NFC).
ClosedPublic

Authored by fhahn on Nov 19 2021, 8:52 AM.

Details

Summary

ILV::scalarizeInstruction still uses the original IR operands to check
if an input value is uniform after vectorization.

There is no need to go back to the cost model to figure that out, as the
information is already explicit in the VPlan. Just check directly
whether the VPValue is defined outside the plan or is a uniform
VPReplicateRecipe.

Diff Detail

Event Timeline

fhahn created this revision.Nov 19 2021, 8:52 AM
fhahn requested review of this revision.Nov 19 2021, 8:52 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 19 2021, 8:52 AM
Herald added a subscriber: vkmr. · View Herald Transcript
fhahn updated this revision to Diff 388911.Nov 22 2021, 7:14 AM

rebased after4348cd42c385

Ayal added inline comments.Nov 28 2021, 12:31 PM
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
3173

Whether a VPValue is "uniform after vectorization" or not should probably be a property of VPValue. Currently this can indeed be detected in VPlan by checking if it has no recipe, or has a uniform replicating recipe. Worth wrapping in a method or function? Its implementation may change when VPValues obtain "type" information and/or when additional scalar recipes may be introduced.

Current patch is ok, as a temporary step; would be good to add a comment.

Op may be confused with Operation; perhaps the original Operand would be better.
RepR may be confused with RepRecipe; perhaps OperandRepR would be better.

fhahn updated this revision to Diff 390293.Nov 29 2021, 2:20 AM

Move logic to VPlan::isUniformAfterVectorization, use it

fhahn marked an inline comment as done.Nov 29 2021, 2:21 AM
fhahn added inline comments.
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
3173

Whether a VPValue is "uniform after vectorization" or not should probably be a property of VPValue

Good point! I move the check logic to VPlan::isUniformAfterVectorization, to avoid tying this directly to the information available for a VPV. Was this what you had in mind by moving it into a function?

Ayal added inline comments.Nov 30 2021, 1:00 AM
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
3173

Yes, it was. Note that in D104254, UAV's (as opposed to truly uniforms) are identified by looking for the address operands of widened memory recipes.

Ayal accepted this revision.Nov 30 2021, 2:37 AM
This revision is now accepted and ready to land.Nov 30 2021, 2:37 AM
This revision was automatically updated to reflect the committed changes.
fhahn marked an inline comment as done.