[llvm] 6e530a3 - [Verifier] enable and limit llvm.experimental.noalias.scope.decl dominance checking
Jeroen Dobbelaere via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 25 07:20:16 PST 2021
Author: Jeroen Dobbelaere
Date: 2021-01-25T16:19:12+01:00
New Revision: 6e530a3dac0c41608bac30f12d59fa3cbca48c4a
URL: https://github.com/llvm/llvm-project/commit/6e530a3dac0c41608bac30f12d59fa3cbca48c4a
DIFF: https://github.com/llvm/llvm-project/commit/6e530a3dac0c41608bac30f12d59fa3cbca48c4a.diff
LOG: [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
Added:
Modified:
llvm/lib/IR/Verifier.cpp
Removed:
################################################################################
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index 8d960770313b..a05c3ed200fd 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -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;
}
}
More information about the llvm-commits
mailing list