Page MenuHomePhabricator

[VPlan] Add moveAfter to VPRecipeBase.

Authored by fhahn on May 14 2018, 3:54 AM.



This patch adds a moveAfter method to VPRecipeBase, which can be used to
move elements after other elements, across VPBasicBlocks, if necessary.

It also adds an initial unittest for VPlan.

Diff Detail

Event Timeline

fhahn created this revision.May 14 2018, 3:54 AM

Thanks for the unittest, Florian! I will be very useful!

543 ↗(On Diff #146572)

instruction -> recipe
VPBasicBloack -> VPBasicBlock

I wonder if it would be better to start a VPInstructionUtils and move this utility there, similar to what I did with VPBlockUtils in D44338.

916 ↗(On Diff #146572)

Just for my understanding, wouldn't it be possible to use getSublistAccess?

fhahn added a comment.May 15 2018, 7:27 AM

Thanks Diego. I think we should be able to use unit tests extensively for VPlan, as it should be quite lightweight to construct a VPlan, run a transformation and check the resulting VPlan.

543 ↗(On Diff #146572)

I added it as member function here because there is a similar Instruction::moveAfter function. I think having a similar member function here makes it easier for people being used to the existing APIs.

916 ↗(On Diff #146572)

Yes I guess we could use getSublistAccess, but I am not entirely sure what the use case of this function is? Its comment says it returns a pointer to a member of the recipe list, but then it ignores the parameter.

IMO it would be better, safer to return a reference (BasicBlock has a similar getInstList function). Maybe getRecipes should be renamed to getRecipeList and we could remove getSublistAccess, as it is not used anywhere?

dcaballe accepted this revision.May 15 2018, 7:54 PM

Only minor comments! LGTM.

543 ↗(On Diff #146572)

I think having a similar member function here makes it easier for people being used to the existing APIs.

Ok, if that's the case for Instruction let's go with this.

916 ↗(On Diff #146572)

Agreed. Yes, please, remove getSublistAccess and let's use getRecipeList.

26 ↗(On Diff #146826)

delete all the new Instructions and VPInstruction will also be necessary here?

This revision is now accepted and ready to land.May 15 2018, 7:54 PM

Just make sure that in the final version of D46827 this code is still necessary.

fhahn added a comment.Jun 14 2018, 5:22 AM

After the recent changes to D46827, this patch is not really necessary for now, but it may be useful in the future.

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptOct 11 2019, 8:42 AM