This is an archive of the discontinued LLVM Phabricator instance.

[LV] Rename blockNeedsPredication to blockNeedsPredicationForAnyReason.
ClosedPublic

Authored by sdesmalen on Nov 8 2021, 3:50 AM.

Details

Summary

The interface is a convenience function to ask if a block requires
predication when widening, but it's important that there are two
separate concepts to consider:
(A) The block was predicated in the original loop.
(B) The block was unpredicated in the original loop, but requires

predication because of tail folding.

In the case of (B) we know that at least one lane of the vector will
be executed, which means we can implementing a load from a uniform address
with a scalar load + splat (D112552). In the case of predication because
of (A), we cannot do this, because the scalar load itself requires
predication.

The name 'blockNeedsPredication' does not make the distinction between
(A) and (B), hence the reason to rename it.

Diff Detail

Event Timeline

sdesmalen created this revision.Nov 8 2021, 3:50 AM
sdesmalen requested review of this revision.Nov 8 2021, 3:50 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 8 2021, 3:50 AM
sdesmalen edited the summary of this revision. (Show Details)Nov 8 2021, 3:51 AM
sdesmalen added reviewers: david-arm, fhahn.
sdesmalen retitled this revision from [LV] Remove LoopVectorizationCostModel::blockNeedsPredication. to [LV] NFC: Remove LoopVectorizationCostModel::blockNeedsPredication..Nov 8 2021, 4:18 AM
This revision is now accepted and ready to land.Nov 10 2021, 1:49 AM
fhahn added a comment.Nov 10 2021, 2:11 AM

Having a dedicated function to check whether a block needs predication for any reason still seems convenient IMO from looking at the updates, if the only place we need to make the distinction for now is isPredicateInst. Perhaps it would be better to change the name to blockNeedsPredicationForAnyReason or something like that so there's a clearer distinction between blockNeedsPredication in Legal?

With a proper doc-comment this would make the code slightly more explicit and it would also be easier to find all places that check for A and B. It would also be easier to update all occurrences, if the condition for A and B needs adjusting.

sdesmalen updated this revision to Diff 386780.Nov 12 2021, 3:16 AM
sdesmalen retitled this revision from [LV] NFC: Remove LoopVectorizationCostModel::blockNeedsPredication. to [LV] Rename blockNeedsPredication to blockNeedsPredicationForAnyReason..
sdesmalen edited the summary of this revision. (Show Details)

Changed patch to rename blockNeedsPredication -> blockNeedsPredicationForAnyReason.

Thanks for the update, LG!