[PATCH] D38676: [LV] Model masking in VPlan, introducing VPInstructions

Gil Rapaport via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 8 12:28:32 PDT 2017


gilr created this revision.

This patch adds a new abstraction layer to VPlan and leverages it to model masking in VPlan. Masking is essential to the vectorizer's predication process, but is currently an ad-hoc side-effect of the vectorized IR-generation stage. Modeling masking directly in VPlan facilitates moving predication from IR-generation stage to the planning stage.

VPlan models the contents of VPBasicBlocks using Recipes, which do not currently expose their planned instructions nor the Def-Use relations between them. Modeling masking in VPlan requires VPlan to model Def-Use relations, specifically among the planned instructions that will generate, manipulate and consume masks.

The new VPValue and VPUser classes model how data flows into, through and out of a VPlan, forming the vertices of a planned Def-Use graph. The new VPInstruction class is a generic single-instruction Recipe that models a planned instruction along with its opcode, operands and users. See VectorizationPlan.rst for more details.

With this patch, VPlan models as VPInstructions the planned instructions that manipulate masks (AND, OR, NOT), introduced during predication. Their operands
are other VPInstructions (e.g., a NOT feeding an AND), or VPValues coming from other Recipes or from live-in values. Their users are other VPInstructions or VPUsers
employed to retrieve the mask during Recipes' execution (e.g., for generating calls to masked load/store intrinsics).

This abstraction layer facilitates modeling additional Def-Use relations in VPlan, to support bringing additional transformations to the planning stage.

Ayal & Gil


https://reviews.llvm.org/D38676

Files:
  docs/Proposals/VectorizationPlan.rst
  lib/Transforms/Vectorize/LoopVectorize.cpp
  lib/Transforms/Vectorize/VPlan.cpp
  lib/Transforms/Vectorize/VPlan.h
  lib/Transforms/Vectorize/VPlanBuilder.h
  lib/Transforms/Vectorize/VPlanValue.h
  test/Transforms/LoopVectorize/if-conversion-nest.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38676.118173.patch
Type: text/x-patch
Size: 60858 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171008/81d57071/attachment.bin>


More information about the llvm-commits mailing list