diff --git a/llvm/include/llvm/Support/GenericDomTreeConstruction.h b/llvm/include/llvm/Support/GenericDomTreeConstruction.h index 2e21bdc9fce2d58..5c3c54c552398a1 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 7e76e4a0f387eb3..2668305e9c84477 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 a4f2dbf9a582899..5ef25c21162fe2c 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 f966ccaa8384223..f69db57c25ed79a 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 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 ff13c0653e9b965..7fca1a6aa526054 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 &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 e3abbdfeb3f3b47..532c464925b1a12 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; }