-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[VPlan] Move predication to VPlanTransform (NFC). #128420
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
2532eb7
25316c2
58c8fc4
fd4f238
91423f6
763d667
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -68,15 +68,7 @@ class VPRecipeBuilder { | |||||
|
|
||||||
| VPBuilder &Builder; | ||||||
|
|
||||||
| /// When we if-convert we need to create edge masks. We have to cache values | ||||||
| /// so that we don't end up with exponential recursion/IR. Note that | ||||||
| /// if-conversion currently takes place during VPlan-construction, so these | ||||||
| /// caches are only used at that stage. | ||||||
| using EdgeMaskCacheTy = | ||||||
| DenseMap<std::pair<BasicBlock *, BasicBlock *>, VPValue *>; | ||||||
| using BlockMaskCacheTy = DenseMap<BasicBlock *, VPValue *>; | ||||||
| EdgeMaskCacheTy EdgeMaskCache; | ||||||
| BlockMaskCacheTy BlockMaskCache; | ||||||
| DenseMap<VPBasicBlock *, VPValue *> &BlockMaskCache; | ||||||
|
|
||||||
| // VPlan construction support: Hold a mapping from ingredients to | ||||||
| // their recipe. | ||||||
|
|
@@ -90,10 +82,6 @@ class VPRecipeBuilder { | |||||
| /// A mapping of partial reduction exit instructions to their scaling factor. | ||||||
| DenseMap<const Instruction *, unsigned> ScaledReductionMap; | ||||||
|
|
||||||
| /// A mapping from VP blocks to IR blocks, used temporarily while migrating | ||||||
| /// away from IR references. | ||||||
| const DenseMap<const VPBlockBase *, BasicBlock *> &VPB2IRBB; | ||||||
|
|
||||||
| /// Loop versioning instance for getting noalias metadata guaranteed by | ||||||
| /// runtime checks. | ||||||
| LoopVersioning *LVer; | ||||||
|
|
@@ -122,11 +110,6 @@ class VPRecipeBuilder { | |||||
| tryToOptimizeInductionTruncate(TruncInst *I, ArrayRef<VPValue *> Operands, | ||||||
| VFRange &Range); | ||||||
|
|
||||||
| /// Handle non-loop phi nodes, returning a new VPBlendRecipe. Currently | ||||||
| /// all such phi nodes are turned into a sequence of select instructions as | ||||||
| /// the vectorizer currently performs full if-conversion. | ||||||
| VPBlendRecipe *tryToBlend(VPWidenPHIRecipe *PhiR); | ||||||
|
|
||||||
| /// Handle call instructions. If \p CI can be widened for \p Range.Start, | ||||||
| /// return a new VPWidenCallRecipe or VPWidenIntrinsicRecipe. Range.End may be | ||||||
| /// decreased to ensure same decision from \p Range.Start to \p Range.End. | ||||||
|
|
@@ -164,10 +147,11 @@ class VPRecipeBuilder { | |||||
| LoopVectorizationLegality *Legal, | ||||||
| LoopVectorizationCostModel &CM, | ||||||
| PredicatedScalarEvolution &PSE, VPBuilder &Builder, | ||||||
| const DenseMap<const VPBlockBase *, BasicBlock *> &VPB2IRBB, | ||||||
| DenseMap<VPBasicBlock *, VPValue *> &BlockMaskCache, | ||||||
| LoopVersioning *LVer) | ||||||
| : Plan(Plan), OrigLoop(OrigLoop), TLI(TLI), TTI(TTI), Legal(Legal), | ||||||
| CM(CM), PSE(PSE), Builder(Builder), VPB2IRBB(VPB2IRBB), LVer(LVer) {} | ||||||
| CM(CM), PSE(PSE), Builder(Builder), BlockMaskCache(BlockMaskCache), | ||||||
| LVer(LVer) {} | ||||||
|
|
||||||
| std::optional<unsigned> getScalingForReduction(const Instruction *ExitInst) { | ||||||
| auto It = ScaledReductionMap.find(ExitInst); | ||||||
|
|
@@ -196,38 +180,10 @@ class VPRecipeBuilder { | |||||
| Ingredient2Recipe[I] = R; | ||||||
| } | ||||||
|
|
||||||
| /// Create the mask for the vector loop header block. | ||||||
| void createHeaderMask(); | ||||||
|
|
||||||
| /// A helper function that computes the predicate of the block BB, assuming | ||||||
| /// that the header block of the loop is set to True or the loop mask when | ||||||
| /// tail folding. | ||||||
| void createBlockInMask(const VPBasicBlock *VPBB) { | ||||||
| return createBlockInMask(VPB2IRBB.lookup(VPBB)); | ||||||
| } | ||||||
| void createBlockInMask(BasicBlock *BB); | ||||||
|
|
||||||
| /// Returns the *entry* mask for the block \p VPBB. | ||||||
| VPValue *getBlockInMask(const VPBasicBlock *VPBB) const { | ||||||
| return getBlockInMask(VPB2IRBB.lookup(VPBB)); | ||||||
| } | ||||||
|
|
||||||
| /// Returns the *entry* mask for the block \p BB. | ||||||
|
||||||
| /// Returns the *entry* mask for the block \p BB. | |
| /// Returns the *entry* mask for block \p VPBB or null if the mask is full. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done thanks, but adjusted to full -> all-true.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: worth removing V from Old2New now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cannot be done for now, as Old2New is used to erase old recipes after updateBlockMaskCache
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -66,8 +66,7 @@ class PlainCFGBuilder { | |||||
| : TheLoop(Lp), LI(LI), Plan(std::make_unique<VPlan>(Lp)) {} | ||||||
|
|
||||||
| /// Build plain CFG for TheLoop and connects it to Plan's entry. | ||||||
|
||||||
| /// Build plain CFG for TheLoop and connects it to Plan's entry. | |
| /// Build plain CFG for TheLoop and connect it to Plan's entry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or some other documentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added thanks