-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[LV][NFC] Refactor structures used to maintain uncountable exit info #123219
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 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -391,25 +391,24 @@ class LoopVectorizationLegality { | |||||
|
|
||||||
| /// Returns true if the loop has an uncountable early exit, i.e. an | ||||||
| /// uncountable exit that isn't the latch block. | ||||||
| bool hasUncountableEarlyExit() const { return HasUncountableEarlyExit; } | ||||||
| bool hasUncountableEarlyExit() const { return getUncountableEdges().size(); } | ||||||
|
|
||||||
| /// Returns the uncountable early exiting block. | ||||||
|
||||||
| /// Returns the uncountable early exiting block. | |
| /// Returns the uncountable early exiting block, if there is a single one. |
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
Outdated
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: may be more compact
| if (!hasUncountableEarlyExit()) | |
| return hasUncountableEarlyExit() ? getUncountableEdge()->first : nullptr;` |
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
Outdated
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.
| /// Returns the destination of an uncountable early exiting block. | |
| /// Returns the destination of the uncountable early exiting block, there is a single one. |
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
david-arm marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
david-arm marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1635,8 +1635,6 @@ bool LoopVectorizationLegality::isVectorizableEarlyExitLoop() { | |
| const SCEV *EC = | ||
| PSE.getSE()->getPredicatedExitCount(TheLoop, BB, &Predicates); | ||
| if (isa<SCEVCouldNotCompute>(EC)) { | ||
| UncountableExitingBlocks.push_back(BB); | ||
|
|
||
| SmallVector<BasicBlock *, 2> Succs(successors(BB)); | ||
| if (Succs.size() != 2) { | ||
| reportVectorizationFailure( | ||
|
|
@@ -1653,7 +1651,7 @@ bool LoopVectorizationLegality::isVectorizableEarlyExitLoop() { | |
| assert(!TheLoop->contains(Succs[1])); | ||
| ExitBlock = Succs[1]; | ||
| } | ||
| UncountableExitBlocks.push_back(ExitBlock); | ||
| UncountableEdges.push_back({BB, ExitBlock}); | ||
|
||
| } else | ||
| CountableExitingBlocks.push_back(BB); | ||
| } | ||
|
|
@@ -1664,7 +1662,7 @@ bool LoopVectorizationLegality::isVectorizableEarlyExitLoop() { | |
| Predicates.clear(); | ||
|
|
||
| // We only support one uncountable early exit. | ||
| if (getUncountableExitingBlocks().size() != 1) { | ||
| if (getUncountableEdges().size() != 1) { | ||
| reportVectorizationFailure( | ||
| "Loop has too many uncountable exits", | ||
| "Cannot vectorize early exit loop with more than one early exit", | ||
|
|
@@ -1812,7 +1810,6 @@ bool LoopVectorizationLegality::canVectorize(bool UseVPlanNativePath) { | |
| return false; | ||
| } | ||
|
|
||
| HasUncountableEarlyExit = false; | ||
| if (isa<SCEVCouldNotCompute>(PSE.getBackedgeTakenCount())) { | ||
| if (TheLoop->getExitingBlock()) { | ||
| reportVectorizationFailure("Cannot vectorize uncountable loop", | ||
|
|
@@ -1822,10 +1819,8 @@ bool LoopVectorizationLegality::canVectorize(bool UseVPlanNativePath) { | |
| else | ||
| return false; | ||
| } else { | ||
| HasUncountableEarlyExit = true; | ||
| if (!isVectorizableEarlyExitLoop()) { | ||
| UncountableExitingBlocks.clear(); | ||
| HasUncountableEarlyExit = false; | ||
| UncountableEdges.clear(); | ||
| if (DoExtraAnalysis) | ||
| Result = false; | ||
| else | ||
|
|
||
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.
Might be good to clarify there must be single edge
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