[llvm-branch-commits] [llvm] [polly] [Support] Use block numbers for LoopInfo BBMap (PR #103400)
Alexis Engelke via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Mar 19 03:14:21 PDT 2026
================
@@ -756,14 +762,33 @@ void LoopInfoBase<BlockT, LoopT>::verify(
// Verify that blocks are mapped to valid loops.
#ifndef NDEBUG
- for (auto &Entry : BBMap) {
- const BlockT *BB = Entry.first;
- LoopT *L = Entry.second;
- assert(Loops.count(L) && "orphaned loop");
- assert(L->contains(BB) && "orphaned block");
- for (LoopT *ChildLoop : *L)
- assert(!ChildLoop->contains(BB) &&
- "BBMap should point to the innermost loop containing BB");
+ if constexpr (GraphHasNodeNumbers<const BlockT *>) {
+ for (auto It : enumerate(BBMap)) {
+ LoopT *L = It.value();
+ unsigned Number = It.index();
+ if (!L)
+ continue;
+ assert(Loops.count(L) && "orphaned loop");
+ // We have no way to map block numbers back to blocks, so find it.
+ auto BBIt = find_if(L->Blocks, [&Number](BlockT *BB) {
+ return GraphTraits<BlockT *>::getNumber(BB) == Number;
+ });
----------------
aengelke wrote:
(The same considerations also apply to CycleInfo, which is much easier to change due to fewer users.)
https://github.com/llvm/llvm-project/pull/103400
More information about the llvm-branch-commits
mailing list