[Mlir-commits] [llvm] [mlir] More `LLVM_ENABLE_ABI_BREAKING_CHECKS` fixes after #110883 (PR #110918)
Benoit Jacob
llvmlistbot at llvm.org
Wed Oct 2 12:43:55 PDT 2024
https://github.com/bjacob updated https://github.com/llvm/llvm-project/pull/110918
>From 1737f767f6b8c3286b456115088df25aabf0ca3b Mon Sep 17 00:00:00 2001
From: Benoit Jacob <jacob.benoit.1 at gmail.com>
Date: Wed, 2 Oct 2024 15:21:37 -0400
Subject: [PATCH] VisitedUnaffected
Signed-off-by: Benoit Jacob <jacob.benoit.1 at gmail.com>
---
llvm/include/llvm/Support/GenericDomTreeConstruction.h | 4 ++--
llvm/lib/Transforms/Scalar/IndVarSimplify.cpp | 2 +-
llvm/lib/Transforms/Scalar/LoopPassManager.cpp | 2 +-
llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp | 4 ++--
llvm/lib/Transforms/Utils/SimplifyIndVar.cpp | 2 +-
mlir/lib/Analysis/Presburger/PresburgerSpace.cpp | 2 ++
6 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/llvm/include/llvm/Support/GenericDomTreeConstruction.h b/llvm/include/llvm/Support/GenericDomTreeConstruction.h
index 2e21bdc9fce2d5..5c3c54c552398a 100644
--- a/llvm/include/llvm/Support/GenericDomTreeConstruction.h
+++ b/llvm/include/llvm/Support/GenericDomTreeConstruction.h
@@ -815,7 +815,7 @@ struct SemiNCAInfo {
LLVM_DEBUG(dbgs() << "\t\tMarking visited not affected "
<< BlockNamePrinter(Succ) << "\n");
UnaffectedOnCurrentLevel.push_back(SuccTN);
-#ifndef NDEBUG
+#if LLVM_ENABLE_ABI_BREAKING_CHECKS
II.VisitedUnaffected.push_back(SuccTN);
#endif
} else {
@@ -849,7 +849,7 @@ struct SemiNCAInfo {
TN->setIDom(NCD);
}
-#if defined(LLVM_ENABLE_ABI_BREAKING_CHECKS) && !defined(NDEBUG)
+#if LLVM_ENABLE_ABI_BREAKING_CHECKS && !defined(NDEBUG)
for (const TreeNodePtr TN : II.VisitedUnaffected)
assert(TN->getLevel() == TN->getIDom()->getLevel() + 1 &&
"TN should have been updated by an affected ancestor");
diff --git a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
index 7e76e4a0f387eb..2668305e9c8447 100644
--- a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
+++ b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
@@ -1920,7 +1920,7 @@ bool IndVarSimplify::run(Loop *L) {
// Create a rewriter object which we'll use to transform the code with.
SCEVExpander Rewriter(*SE, DL, "indvars");
-#ifndef NDEBUG
+#if LLVM_ENABLE_ABI_BREAKING_CHECKS
Rewriter.setDebugType(DEBUG_TYPE);
#endif
diff --git a/llvm/lib/Transforms/Scalar/LoopPassManager.cpp b/llvm/lib/Transforms/Scalar/LoopPassManager.cpp
index a4f2dbf9a58289..5ef25c21162fe2 100644
--- a/llvm/lib/Transforms/Scalar/LoopPassManager.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopPassManager.cpp
@@ -293,7 +293,7 @@ PreservedAnalyses FunctionToLoopPassAdaptor::run(Function &F,
Updater.CurrentL = L;
Updater.SkipCurrentLoop = false;
-#ifndef NDEBUG
+#if LLVM_ENABLE_ABI_BREAKING_CHECKS
// Save a parent loop pointer for asserts.
Updater.ParentL = L->getParentLoop();
#endif
diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
index f966ccaa838422..f69db57c25ed79 100644
--- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
@@ -6188,7 +6188,7 @@ LSRInstance::LSRInstance(Loop *L, IVUsers &IU, ScalarEvolution &SE,
// Configure SCEVExpander already now, so the correct mode is used for
// isSafeToExpand() checks.
-#ifndef NDEBUG
+#if LLVM_ENABLE_ABI_BREAKING_CHECKS
Rewriter.setDebugType(DEBUG_TYPE);
#endif
Rewriter.disableCanonicalMode();
@@ -7084,7 +7084,7 @@ static bool ReduceLoopStrength(Loop *L, IVUsers &IU, ScalarEvolution &SE,
SmallVector<WeakTrackingVH, 16> DeadInsts;
const DataLayout &DL = L->getHeader()->getDataLayout();
SCEVExpander Rewriter(SE, DL, "lsr", false);
-#ifndef NDEBUG
+#if LLVM_ENABLE_ABI_BREAKING_CHECKS
Rewriter.setDebugType(DEBUG_TYPE);
#endif
unsigned numFolded = Rewriter.replaceCongruentIVs(L, &DT, DeadInsts, &TTI);
diff --git a/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp b/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
index ff13c0653e9b96..7fca1a6aa52605 100644
--- a/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
@@ -1024,7 +1024,7 @@ bool simplifyLoopIVs(Loop *L, ScalarEvolution *SE, DominatorTree *DT,
LoopInfo *LI, const TargetTransformInfo *TTI,
SmallVectorImpl<WeakTrackingVH> &Dead) {
SCEVExpander Rewriter(*SE, SE->getDataLayout(), "indvars");
-#ifndef NDEBUG
+#if LLVM_ENABLE_ABI_BREAKING_CHECKS
Rewriter.setDebugType(DEBUG_TYPE);
#endif
bool Changed = false;
diff --git a/mlir/lib/Analysis/Presburger/PresburgerSpace.cpp b/mlir/lib/Analysis/Presburger/PresburgerSpace.cpp
index e3abbdfeb3f3b4..532c464925b1a1 100644
--- a/mlir/lib/Analysis/Presburger/PresburgerSpace.cpp
+++ b/mlir/lib/Analysis/Presburger/PresburgerSpace.cpp
@@ -18,9 +18,11 @@ using namespace presburger;
bool Identifier::isEqual(const Identifier &other) const {
if (value == nullptr || other.value == nullptr)
return false;
+#if LLVM_ENABLE_ABI_BREAKING_CHECKS
assert(value != other.value ||
(value == other.value && idType == other.idType &&
"Values of Identifiers are equal but their types do not match."));
+#endif
return value == other.value;
}
More information about the Mlir-commits
mailing list