[llvm] [LV][NFC] Refactor structures used to maintain uncountable exit info (PR #123219)
David Sherwood via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 17 07:55:42 PST 2025
================
@@ -391,25 +391,22 @@ 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 getUncountableEdge().has_value();
+ }
/// Returns the uncountable early exiting block.
BasicBlock *getUncountableEarlyExitingBlock() const {
- if (!HasUncountableEarlyExit) {
- assert(getUncountableExitingBlocks().empty() &&
- "Expected no uncountable exiting blocks");
+ if (!hasUncountableEarlyExit())
return nullptr;
- }
- assert(getUncountableExitingBlocks().size() == 1 &&
- "Expected only a single uncountable exiting block");
- return getUncountableExitingBlocks()[0];
+ return (*getUncountableEdge()).first;
}
/// Returns the destination of an uncountable early exiting block.
BasicBlock *getUncountableEarlyExitBlock() const {
- assert(getUncountableExitBlocks().size() == 1 &&
- "Expected only a single uncountable exit block");
- return getUncountableExitBlocks()[0];
+ if (!hasUncountableEarlyExit())
+ return nullptr;
+ return (*getUncountableEdge()).second;
----------------
david-arm wrote:
Done
https://github.com/llvm/llvm-project/pull/123219
More information about the llvm-commits
mailing list