diff --git a/llvm/include/llvm/Passes/StandardInstrumentations.h b/llvm/include/llvm/Passes/StandardInstrumentations.h index 80eedc52bc324..fa9c744294a66 100644 --- a/llvm/include/llvm/Passes/StandardInstrumentations.h +++ b/llvm/include/llvm/Passes/StandardInstrumentations.h @@ -171,7 +171,7 @@ class PreservedCFGCheckerInstrumentation { FunctionAnalysisManager::Invalidator &); }; -#if LLVM_ENABLE_ABI_BREAKING_CHECKS +#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS SmallVector PassStack; #endif diff --git a/llvm/include/llvm/Support/GenericDomTreeConstruction.h b/llvm/include/llvm/Support/GenericDomTreeConstruction.h index 2e21bdc9fce2d..9aab5ec60f4a2 100644 --- a/llvm/include/llvm/Support/GenericDomTreeConstruction.h +++ b/llvm/include/llvm/Support/GenericDomTreeConstruction.h @@ -640,7 +640,7 @@ struct SemiNCAInfo { Bucket; SmallDenseSet Visited; SmallVector Affected; -#if LLVM_ENABLE_ABI_BREAKING_CHECKS +#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS SmallVector VisitedUnaffected; #endif }; @@ -915,7 +915,7 @@ struct SemiNCAInfo { LLVM_DEBUG(dbgs() << "Deleting edge " << BlockNamePrinter(From) << " -> " << BlockNamePrinter(To) << "\n"); -#if LLVM_ENABLE_ABI_BREAKING_CHECKS +#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS // Ensure that the edge was in fact deleted from the CFG before informing // the DomTree about it. // The check is O(N), so run it only in debug configuration. diff --git a/llvm/include/llvm/Transforms/Scalar/LoopPassManager.h b/llvm/include/llvm/Transforms/Scalar/LoopPassManager.h index db479f55d9b03..3858be05c61fa 100644 --- a/llvm/include/llvm/Transforms/Scalar/LoopPassManager.h +++ b/llvm/include/llvm/Transforms/Scalar/LoopPassManager.h @@ -256,7 +256,7 @@ class LPMUpdater { } void setParentLoop(Loop *L) { -#if LLVM_ENABLE_ABI_BREAKING_CHECKS +#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS ParentL = L; #endif } @@ -347,7 +347,7 @@ class LPMUpdater { const bool LoopNestMode; bool LoopNestChanged; -#if LLVM_ENABLE_ABI_BREAKING_CHECKS +#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS // In debug builds we also track the parent loop to implement asserts even in // the face of loop deletion. Loop *ParentL; diff --git a/llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h b/llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h index 468b50092efcf..62c1e15a9a60e 100644 --- a/llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h +++ b/llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h @@ -167,7 +167,7 @@ class SCEVExpander : public SCEVVisitor { /// consistent when instructions are moved. SmallVector InsertPointGuards; -#if LLVM_ENABLE_ABI_BREAKING_CHECKS +#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS const char *DebugType; #endif @@ -183,7 +183,7 @@ class SCEVExpander : public SCEVVisitor { Builder(se.getContext(), InstSimplifyFolder(DL), IRBuilderCallbackInserter( [this](Instruction *I) { rememberInstruction(I); })) { -#if LLVM_ENABLE_ABI_BREAKING_CHECKS +#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS DebugType = ""; #endif } @@ -193,7 +193,7 @@ class SCEVExpander : public SCEVVisitor { assert(InsertPointGuards.empty()); } -#if LLVM_ENABLE_ABI_BREAKING_CHECKS +#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS void setDebugType(const char *s) { DebugType = s; } #endif diff --git a/llvm/lib/Passes/StandardInstrumentations.cpp b/llvm/lib/Passes/StandardInstrumentations.cpp index a545ae5862397..036484c9c1c0c 100644 --- a/llvm/lib/Passes/StandardInstrumentations.cpp +++ b/llvm/lib/Passes/StandardInstrumentations.cpp @@ -1357,7 +1357,7 @@ void PreservedCFGCheckerInstrumentation::registerCallbacks( bool Registered = false; PIC.registerBeforeNonSkippedPassCallback([this, &MAM, Registered]( StringRef P, Any IR) mutable { -#if LLVM_ENABLE_ABI_BREAKING_CHECKS +#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS assert(&PassStack.emplace_back(P)); #endif (void)this; @@ -1386,7 +1386,7 @@ void PreservedCFGCheckerInstrumentation::registerCallbacks( PIC.registerAfterPassInvalidatedCallback( [this](StringRef P, const PreservedAnalyses &PassPA) { -#if LLVM_ENABLE_ABI_BREAKING_CHECKS +#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS assert(PassStack.pop_back_val() == P && "Before and After callbacks must correspond"); #endif @@ -1395,7 +1395,7 @@ void PreservedCFGCheckerInstrumentation::registerCallbacks( PIC.registerAfterPassCallback([this, &MAM](StringRef P, Any IR, const PreservedAnalyses &PassPA) { -#if LLVM_ENABLE_ABI_BREAKING_CHECKS +#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS assert(PassStack.pop_back_val() == P && "Before and After callbacks must correspond"); #endif diff --git a/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp b/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp index 2119320566902..0927a3015818f 100644 --- a/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp +++ b/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp @@ -28,7 +28,7 @@ #include "llvm/Support/raw_ostream.h" #include "llvm/Transforms/Utils/LoopUtils.h" -#if LLVM_ENABLE_ABI_BREAKING_CHECKS +#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS #define SCEV_DEBUG_WITH_TYPE(TYPE, X) DEBUG_WITH_TYPE(TYPE, X) #else #define SCEV_DEBUG_WITH_TYPE(TYPE, X) diff --git a/mlir/include/mlir/Analysis/Presburger/PresburgerSpace.h b/mlir/include/mlir/Analysis/Presburger/PresburgerSpace.h index 97573b6e45301..cff7957989871 100644 --- a/mlir/include/mlir/Analysis/Presburger/PresburgerSpace.h +++ b/mlir/include/mlir/Analysis/Presburger/PresburgerSpace.h @@ -75,7 +75,7 @@ class Identifier { template explicit Identifier(T value) : value(llvm::PointerLikeTypeTraits::getAsVoidPointer(value)) { -#if LLVM_ENABLE_ABI_BREAKING_CHECKS +#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS idType = llvm::getTypeName(); #endif } @@ -84,7 +84,7 @@ class Identifier { /// the type of the identifier used to create it. template T getValue() const { -#if LLVM_ENABLE_ABI_BREAKING_CHECKS +#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS assert(llvm::getTypeName() == idType && "Identifier was initialized with a different type than the one used " "to retrieve it."); @@ -108,7 +108,7 @@ class Identifier { /// The value of the identifier. void *value = nullptr; -#if LLVM_ENABLE_ABI_BREAKING_CHECKS +#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS /// TypeID of the identifiers in space. This should be used in asserts only. llvm::StringRef idType; #endif diff --git a/mlir/include/mlir/Dialect/Transform/Interfaces/TransformInterfaces.h b/mlir/include/mlir/Dialect/Transform/Interfaces/TransformInterfaces.h index e51aac02936b5..43193e4cd4cf6 100644 --- a/mlir/include/mlir/Dialect/Transform/Interfaces/TransformInterfaces.h +++ b/mlir/include/mlir/Dialect/Transform/Interfaces/TransformInterfaces.h @@ -196,7 +196,7 @@ class TransformState { /// should be emitted when the value is used. using InvalidatedHandleMap = DenseMap>; -#if LLVM_ENABLE_ABI_BREAKING_CHECKS +#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS /// Debug only: A timestamp is associated with each transform IR value, so /// that invalid iterator usage can be detected more reliably. using TransformIRTimestampMapping = DenseMap; @@ -211,7 +211,7 @@ class TransformState { ValueMapping values; ValueMapping reverseValues; -#if LLVM_ENABLE_ABI_BREAKING_CHECKS +#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS TransformIRTimestampMapping timestamps; void incrementTimestamp(Value value) { ++timestamps[value]; } #endif // LLVM_ENABLE_ABI_BREAKING_CHECKS @@ -248,7 +248,7 @@ class TransformState { auto getPayloadOps(Value value) const { ArrayRef view = getPayloadOpsView(value); -#if LLVM_ENABLE_ABI_BREAKING_CHECKS +#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS // Memorize the current timestamp and make sure that it has not changed // when incrementing or dereferencing the iterator returned by this // function. The timestamp is incremented when the "direct" mapping is @@ -259,7 +259,7 @@ class TransformState { // When ops are replaced/erased, they are replaced with nullptr (until // the data structure is compacted). Do not enumerate these ops. return llvm::make_filter_range(view, [=](Operation *op) { -#if LLVM_ENABLE_ABI_BREAKING_CHECKS +#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS [[maybe_unused]] bool sameTimestamp = currentTimestamp == this->getMapping(value).timestamps.lookup(value); assert(sameTimestamp && "iterator was invalidated during iteration"); @@ -277,7 +277,7 @@ class TransformState { auto getPayloadValues(Value handleValue) const { ArrayRef view = getPayloadValuesView(handleValue); -#if LLVM_ENABLE_ABI_BREAKING_CHECKS +#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS // Memorize the current timestamp and make sure that it has not changed // when incrementing or dereferencing the iterator returned by this // function. The timestamp is incremented when the "values" mapping is diff --git a/mlir/lib/Dialect/Transform/Interfaces/TransformInterfaces.cpp b/mlir/lib/Dialect/Transform/Interfaces/TransformInterfaces.cpp index fdd968238667e..91702ce7cc42b 100644 --- a/mlir/lib/Dialect/Transform/Interfaces/TransformInterfaces.cpp +++ b/mlir/lib/Dialect/Transform/Interfaces/TransformInterfaces.cpp @@ -330,7 +330,7 @@ void transform::TransformState::forgetMapping(Value opHandle, for (Operation *op : mappings.direct[opHandle]) dropMappingEntry(mappings.reverse, op, opHandle); mappings.direct.erase(opHandle); -#if LLVM_ENABLE_ABI_BREAKING_CHECKS +#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS // Payload IR is removed from the mapping. This invalidates the respective // iterators. mappings.incrementTimestamp(opHandle); @@ -342,7 +342,7 @@ void transform::TransformState::forgetMapping(Value opHandle, for (Value resultHandle : resultHandles) { Mappings &localMappings = getMapping(resultHandle); dropMappingEntry(localMappings.values, resultHandle, opResult); -#if LLVM_ENABLE_ABI_BREAKING_CHECKS +#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS // Payload IR is removed from the mapping. This invalidates the respective // iterators. mappings.incrementTimestamp(resultHandle); @@ -358,7 +358,7 @@ void transform::TransformState::forgetValueMapping( for (Value payloadValue : mappings.reverseValues[valueHandle]) dropMappingEntry(mappings.reverseValues, payloadValue, valueHandle); mappings.values.erase(valueHandle); -#if LLVM_ENABLE_ABI_BREAKING_CHECKS +#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS // Payload IR is removed from the mapping. This invalidates the respective // iterators. mappings.incrementTimestamp(valueHandle); @@ -372,7 +372,7 @@ void transform::TransformState::forgetValueMapping( dropMappingEntry(localMappings.direct, opHandle, payloadOp); dropMappingEntry(localMappings.reverse, payloadOp, opHandle); -#if LLVM_ENABLE_ABI_BREAKING_CHECKS +#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS // Payload IR is removed from the mapping. This invalidates the respective // iterators. localMappings.incrementTimestamp(opHandle); @@ -452,7 +452,7 @@ transform::TransformState::replacePayloadValue(Value value, Value replacement) { // between the handles and the IR objects if (!replacement) { dropMappingEntry(mappings.values, handle, value); -#if LLVM_ENABLE_ABI_BREAKING_CHECKS +#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS // Payload IR is removed from the mapping. This invalidates the respective // iterators. mappings.incrementTimestamp(handle); @@ -804,7 +804,7 @@ checkRepeatedConsumptionInOperand(ArrayRef payload, void transform::TransformState::compactOpHandles() { for (Value handle : opHandlesToCompact) { Mappings &mappings = getMapping(handle, /*allowOutOfScope=*/true); -#if LLVM_ENABLE_ABI_BREAKING_CHECKS +#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS if (llvm::find(mappings.direct[handle], nullptr) != mappings.direct[handle].end()) // Payload IR is removed from the mapping. This invalidates the respective