Skip to content

Commit 6e530a3

Browse files
committed
[Verifier] enable and limit llvm.experimental.noalias.scope.decl dominance checking
Checking the llvm.experimental.noalias.scope.decl dominance can be worstcase O(N^2). Limit the dominance check to N=32. Reviewed By: fhahn Differential Revision: https://reviews.llvm.org/D95335
1 parent 7e506b3 commit 6e530a3

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

llvm/lib/IR/Verifier.cpp

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@
116116
using namespace llvm;
117117

118118
static cl::opt<bool> VerifyNoAliasScopeDomination(
119-
"verify-noalias-scope-decl-dom", cl::Hidden, cl::init(false),
119+
"verify-noalias-scope-decl-dom", cl::Hidden, cl::init(true),
120120
cl::desc("Ensure that llvm.experimental.noalias.scope.decl for identical "
121121
"scopes are not dominating"));
122122

@@ -5587,18 +5587,17 @@ void Verifier::verifyNoAliasScopeDecl() {
55875587
} while (ItNext != NoAliasScopeDecls.end() &&
55885588
GetScope(*ItNext) == CurScope);
55895589

5590-
// [ItCurrent, ItNext[ represents the declarations for the same scope.
5591-
// Ensure they are not dominating each other
5592-
for (auto *I : llvm::make_range(ItCurrent, ItNext)) {
5593-
for (auto *J : llvm::make_range(ItCurrent, ItNext)) {
5594-
if (I != J) {
5595-
Assert(!DT.dominates(I, J),
5596-
"llvm.experimental.noalias.scope.decl dominates another one "
5597-
"with the same scope",
5598-
I);
5599-
}
5600-
}
5601-
}
5590+
// [ItCurrent, ItNext) represents the declarations for the same scope.
5591+
// Ensure they are not dominating each other.. but only if it is not too
5592+
// expensive.
5593+
if (ItNext - ItCurrent < 32)
5594+
for (auto *I : llvm::make_range(ItCurrent, ItNext))
5595+
for (auto *J : llvm::make_range(ItCurrent, ItNext))
5596+
if (I != J)
5597+
Assert(!DT.dominates(I, J),
5598+
"llvm.experimental.noalias.scope.decl dominates another one "
5599+
"with the same scope",
5600+
I);
56025601
ItCurrent = ItNext;
56035602
}
56045603
}

0 commit comments

Comments
 (0)