[PATCH] D84679: [VPlan] Disconnect VPValue and VPUser.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 21 10:09:04 PDT 2020


fhahn added a comment.

> This looks good to me, as part of the effort to support VPlan def-use modeling and traversals.
> Note that top-down traversal from VPValue to its VPUsers, will now need to check if each VPUser isa single-def recipe/VPInstruction in order to continue downwards to its VPUsers, etc., facilitating multi-def recipes.

Thanks Ayal! I'll address the comments shortly.

In D84679#2285679 <https://reviews.llvm.org/D84679#2285679>, @dmgreen wrote:

> I was trying very recently to get VPlan to perform some vector combines. Things like recognizing vmulh patterns.
>
> The code I had was still in a very rough state but I ended up going in completely the opposite direction. I had VPRecipeBase inherit from VPUser, which in turn inherited from VPValue. Like I said it was all very rough and I'm not sure yet if it was necessary, but I felt like it simplified things. It was useful to know you could inspect operands and uses of any recipe, and properly walk up and down the def-uses chain. Perform things like replaceAllUsesWith and recursively delete dead recipes after replacing them with others.

I am not sure if it is completely the opposite direction.

With this patch, `VPRecipeBase` is also a `VPUser` and a `VPValue`, it just inherits from both directly, rather than indirectly through `VPValue`. Note that 'replacing all uses with & co' are provided by VPValue, so all instances that could previously be RAUW'd can still be RAUW'd.  The only major difference should be that in the future we may need some extra code to get the uses of a `VPUser`.

This will help finishing the move to model the use-def chains entirely in VPlan, which in turn should make it possible to easily do VPlan-to-VPlan transformations, like the vector combines you mentioned.

Does that make sense?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84679/new/

https://reviews.llvm.org/D84679



More information about the llvm-commits mailing list