1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 10:42:39 +01:00

[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
This commit is contained in:
Jeroen Dobbelaere 2021-01-25 16:19:12 +01:00
parent 0d37ea875a
commit 8d875453b4

View File

@ -116,7 +116,7 @@
using namespace llvm;
static cl::opt<bool> VerifyNoAliasScopeDomination(
"verify-noalias-scope-decl-dom", cl::Hidden, cl::init(false),
"verify-noalias-scope-decl-dom", cl::Hidden, cl::init(true),
cl::desc("Ensure that llvm.experimental.noalias.scope.decl for identical "
"scopes are not dominating"));
@ -5587,18 +5587,17 @@ void Verifier::verifyNoAliasScopeDecl() {
} while (ItNext != NoAliasScopeDecls.end() &&
GetScope(*ItNext) == CurScope);
// [ItCurrent, ItNext[ represents the declarations for the same scope.
// Ensure they are not dominating each other
for (auto *I : llvm::make_range(ItCurrent, ItNext)) {
for (auto *J : llvm::make_range(ItCurrent, ItNext)) {
if (I != J) {
Assert(!DT.dominates(I, J),
"llvm.experimental.noalias.scope.decl dominates another one "
"with the same scope",
I);
}
}
}
// [ItCurrent, ItNext) represents the declarations for the same scope.
// Ensure they are not dominating each other.. but only if it is not too
// expensive.
if (ItNext - ItCurrent < 32)
for (auto *I : llvm::make_range(ItCurrent, ItNext))
for (auto *J : llvm::make_range(ItCurrent, ItNext))
if (I != J)
Assert(!DT.dominates(I, J),
"llvm.experimental.noalias.scope.decl dominates another one "
"with the same scope",
I);
ItCurrent = ItNext;
}
}