1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-26 04:32:44 +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; using namespace llvm;
static cl::opt<bool> VerifyNoAliasScopeDomination( 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 " cl::desc("Ensure that llvm.experimental.noalias.scope.decl for identical "
"scopes are not dominating")); "scopes are not dominating"));
@ -5587,18 +5587,17 @@ void Verifier::verifyNoAliasScopeDecl() {
} while (ItNext != NoAliasScopeDecls.end() && } while (ItNext != NoAliasScopeDecls.end() &&
GetScope(*ItNext) == CurScope); GetScope(*ItNext) == CurScope);
// [ItCurrent, ItNext[ represents the declarations for the same scope. // [ItCurrent, ItNext) represents the declarations for the same scope.
// Ensure they are not dominating each other // Ensure they are not dominating each other.. but only if it is not too
for (auto *I : llvm::make_range(ItCurrent, ItNext)) { // expensive.
for (auto *J : llvm::make_range(ItCurrent, ItNext)) { if (ItNext - ItCurrent < 32)
if (I != J) { for (auto *I : llvm::make_range(ItCurrent, ItNext))
Assert(!DT.dominates(I, J), for (auto *J : llvm::make_range(ItCurrent, ItNext))
"llvm.experimental.noalias.scope.decl dominates another one " if (I != J)
"with the same scope", Assert(!DT.dominates(I, J),
I); "llvm.experimental.noalias.scope.decl dominates another one "
} "with the same scope",
} I);
}
ItCurrent = ItNext; ItCurrent = ItNext;
} }
} }