This is an archive of the discontinued LLVM Phabricator instance.

[LV] Replace some uses of VectorLoopValueMap with VPTransformState (NFC)
ClosedPublic

Authored by fhahn on Jan 31 2021, 5:23 AM.

Details

Summary

This patch updates some places where VectorLoopValueMap is accessed
directly to instead go through VPTransformState.

As we move towards managing created values exclusively in VPTransformState,
this ensures the use always can fetch the correct value.

This is in preparation for D92285, which switches to managing scalarized
values through VPValues.

In the future, the various fix* functions should be moved directly into
the VPlan codegen stage.

Diff Detail

Event Timeline

fhahn created this revision.Jan 31 2021, 5:23 AM
fhahn requested review of this revision.Jan 31 2021, 5:23 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 31 2021, 5:23 AM
Herald added a subscriber: vkmr. · View Herald Transcript
gilr added inline comments.Feb 3 2021, 10:46 AM
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
4234

We could have VPTransformState hold a pointer to the plan being executed to save passing it separately. What do you think?

4463–4466

Simpler to follow getOrCreateScalarValue() logic?
...= OrigLoop->isLoopInvariant(IncomingValue)) ? IncomingValue : State.get(...)

fhahn updated this revision to Diff 321339.Feb 4 2021, 1:03 AM

Addressed comments: add VPlan* to VPTransformState and use isLoopInvariant.

Thanks!

fhahn marked an inline comment as done.Feb 4 2021, 1:04 AM
fhahn added inline comments.
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
4234

I think that's better! I updated the code. There are probably other places which can be updated as well to use the pointer in VPTransformState. I can update those in a separate commit.

4463–4466

That's much better, thanks! Updated the code.

fhahn marked 2 inline comments as done.Feb 4 2021, 9:57 AM
gilr accepted this revision.Feb 7 2021, 9:21 AM

LGTM, thanks!

This revision is now accepted and ready to land.Feb 7 2021, 9:21 AM
This revision was landed with ongoing or failed builds.Feb 7 2021, 10:30 AM
This revision was automatically updated to reflect the committed changes.
fhahn added a comment.Feb 7 2021, 10:31 AM

Thanks for taking a look Gil!