Skip to content

Commit 68ddd6c

Browse files
authored
Revert "Fix LLVM_ENABLE_ABI_BREAKING_CHECKS macro check: use #if instead of #ifdef" (#110310)
Reverts #110185 There are inconsistencies in some of these macros, which unfortunately isn't caught by a single upstream bot.
1 parent 2804775 commit 68ddd6c

File tree

9 files changed

+26
-26
lines changed

9 files changed

+26
-26
lines changed

llvm/include/llvm/Passes/StandardInstrumentations.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ class PreservedCFGCheckerInstrumentation {
171171
FunctionAnalysisManager::Invalidator &);
172172
};
173173

174-
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
174+
#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS
175175
SmallVector<StringRef, 8> PassStack;
176176
#endif
177177

llvm/include/llvm/Support/GenericDomTreeConstruction.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ struct SemiNCAInfo {
640640
Bucket;
641641
SmallDenseSet<TreeNodePtr, 8> Visited;
642642
SmallVector<TreeNodePtr, 8> Affected;
643-
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
643+
#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS
644644
SmallVector<TreeNodePtr, 8> VisitedUnaffected;
645645
#endif
646646
};
@@ -915,7 +915,7 @@ struct SemiNCAInfo {
915915
LLVM_DEBUG(dbgs() << "Deleting edge " << BlockNamePrinter(From) << " -> "
916916
<< BlockNamePrinter(To) << "\n");
917917

918-
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
918+
#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS
919919
// Ensure that the edge was in fact deleted from the CFG before informing
920920
// the DomTree about it.
921921
// The check is O(N), so run it only in debug configuration.

llvm/include/llvm/Transforms/Scalar/LoopPassManager.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ class LPMUpdater {
256256
}
257257

258258
void setParentLoop(Loop *L) {
259-
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
259+
#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS
260260
ParentL = L;
261261
#endif
262262
}
@@ -347,7 +347,7 @@ class LPMUpdater {
347347
const bool LoopNestMode;
348348
bool LoopNestChanged;
349349

350-
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
350+
#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS
351351
// In debug builds we also track the parent loop to implement asserts even in
352352
// the face of loop deletion.
353353
Loop *ParentL;

llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ class SCEVExpander : public SCEVVisitor<SCEVExpander, Value *> {
167167
/// consistent when instructions are moved.
168168
SmallVector<SCEVInsertPointGuard *, 8> InsertPointGuards;
169169

170-
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
170+
#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS
171171
const char *DebugType;
172172
#endif
173173

@@ -183,7 +183,7 @@ class SCEVExpander : public SCEVVisitor<SCEVExpander, Value *> {
183183
Builder(se.getContext(), InstSimplifyFolder(DL),
184184
IRBuilderCallbackInserter(
185185
[this](Instruction *I) { rememberInstruction(I); })) {
186-
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
186+
#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS
187187
DebugType = "";
188188
#endif
189189
}
@@ -193,7 +193,7 @@ class SCEVExpander : public SCEVVisitor<SCEVExpander, Value *> {
193193
assert(InsertPointGuards.empty());
194194
}
195195

196-
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
196+
#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS
197197
void setDebugType(const char *s) { DebugType = s; }
198198
#endif
199199

llvm/lib/Passes/StandardInstrumentations.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1357,7 +1357,7 @@ void PreservedCFGCheckerInstrumentation::registerCallbacks(
13571357
bool Registered = false;
13581358
PIC.registerBeforeNonSkippedPassCallback([this, &MAM, Registered](
13591359
StringRef P, Any IR) mutable {
1360-
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
1360+
#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS
13611361
assert(&PassStack.emplace_back(P));
13621362
#endif
13631363
(void)this;
@@ -1386,7 +1386,7 @@ void PreservedCFGCheckerInstrumentation::registerCallbacks(
13861386

13871387
PIC.registerAfterPassInvalidatedCallback(
13881388
[this](StringRef P, const PreservedAnalyses &PassPA) {
1389-
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
1389+
#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS
13901390
assert(PassStack.pop_back_val() == P &&
13911391
"Before and After callbacks must correspond");
13921392
#endif
@@ -1395,7 +1395,7 @@ void PreservedCFGCheckerInstrumentation::registerCallbacks(
13951395

13961396
PIC.registerAfterPassCallback([this, &MAM](StringRef P, Any IR,
13971397
const PreservedAnalyses &PassPA) {
1398-
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
1398+
#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS
13991399
assert(PassStack.pop_back_val() == P &&
14001400
"Before and After callbacks must correspond");
14011401
#endif

llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#include "llvm/Support/raw_ostream.h"
2929
#include "llvm/Transforms/Utils/LoopUtils.h"
3030

31-
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
31+
#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS
3232
#define SCEV_DEBUG_WITH_TYPE(TYPE, X) DEBUG_WITH_TYPE(TYPE, X)
3333
#else
3434
#define SCEV_DEBUG_WITH_TYPE(TYPE, X)

mlir/include/mlir/Analysis/Presburger/PresburgerSpace.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class Identifier {
7575
template <typename T>
7676
explicit Identifier(T value)
7777
: value(llvm::PointerLikeTypeTraits<T>::getAsVoidPointer(value)) {
78-
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
78+
#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS
7979
idType = llvm::getTypeName<T>();
8080
#endif
8181
}
@@ -84,7 +84,7 @@ class Identifier {
8484
/// the type of the identifier used to create it.
8585
template <typename T>
8686
T getValue() const {
87-
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
87+
#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS
8888
assert(llvm::getTypeName<T>() == idType &&
8989
"Identifier was initialized with a different type than the one used "
9090
"to retrieve it.");
@@ -108,7 +108,7 @@ class Identifier {
108108
/// The value of the identifier.
109109
void *value = nullptr;
110110

111-
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
111+
#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS
112112
/// TypeID of the identifiers in space. This should be used in asserts only.
113113
llvm::StringRef idType;
114114
#endif

mlir/include/mlir/Dialect/Transform/Interfaces/TransformInterfaces.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ class TransformState {
196196
/// should be emitted when the value is used.
197197
using InvalidatedHandleMap = DenseMap<Value, std::function<void(Location)>>;
198198

199-
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
199+
#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS
200200
/// Debug only: A timestamp is associated with each transform IR value, so
201201
/// that invalid iterator usage can be detected more reliably.
202202
using TransformIRTimestampMapping = DenseMap<Value, int64_t>;
@@ -211,7 +211,7 @@ class TransformState {
211211
ValueMapping values;
212212
ValueMapping reverseValues;
213213

214-
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
214+
#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS
215215
TransformIRTimestampMapping timestamps;
216216
void incrementTimestamp(Value value) { ++timestamps[value]; }
217217
#endif // LLVM_ENABLE_ABI_BREAKING_CHECKS
@@ -248,7 +248,7 @@ class TransformState {
248248
auto getPayloadOps(Value value) const {
249249
ArrayRef<Operation *> view = getPayloadOpsView(value);
250250

251-
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
251+
#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS
252252
// Memorize the current timestamp and make sure that it has not changed
253253
// when incrementing or dereferencing the iterator returned by this
254254
// function. The timestamp is incremented when the "direct" mapping is
@@ -259,7 +259,7 @@ class TransformState {
259259
// When ops are replaced/erased, they are replaced with nullptr (until
260260
// the data structure is compacted). Do not enumerate these ops.
261261
return llvm::make_filter_range(view, [=](Operation *op) {
262-
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
262+
#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS
263263
[[maybe_unused]] bool sameTimestamp =
264264
currentTimestamp == this->getMapping(value).timestamps.lookup(value);
265265
assert(sameTimestamp && "iterator was invalidated during iteration");
@@ -277,7 +277,7 @@ class TransformState {
277277
auto getPayloadValues(Value handleValue) const {
278278
ArrayRef<Value> view = getPayloadValuesView(handleValue);
279279

280-
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
280+
#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS
281281
// Memorize the current timestamp and make sure that it has not changed
282282
// when incrementing or dereferencing the iterator returned by this
283283
// function. The timestamp is incremented when the "values" mapping is

mlir/lib/Dialect/Transform/Interfaces/TransformInterfaces.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ void transform::TransformState::forgetMapping(Value opHandle,
330330
for (Operation *op : mappings.direct[opHandle])
331331
dropMappingEntry(mappings.reverse, op, opHandle);
332332
mappings.direct.erase(opHandle);
333-
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
333+
#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS
334334
// Payload IR is removed from the mapping. This invalidates the respective
335335
// iterators.
336336
mappings.incrementTimestamp(opHandle);
@@ -342,7 +342,7 @@ void transform::TransformState::forgetMapping(Value opHandle,
342342
for (Value resultHandle : resultHandles) {
343343
Mappings &localMappings = getMapping(resultHandle);
344344
dropMappingEntry(localMappings.values, resultHandle, opResult);
345-
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
345+
#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS
346346
// Payload IR is removed from the mapping. This invalidates the respective
347347
// iterators.
348348
mappings.incrementTimestamp(resultHandle);
@@ -358,7 +358,7 @@ void transform::TransformState::forgetValueMapping(
358358
for (Value payloadValue : mappings.reverseValues[valueHandle])
359359
dropMappingEntry(mappings.reverseValues, payloadValue, valueHandle);
360360
mappings.values.erase(valueHandle);
361-
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
361+
#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS
362362
// Payload IR is removed from the mapping. This invalidates the respective
363363
// iterators.
364364
mappings.incrementTimestamp(valueHandle);
@@ -372,7 +372,7 @@ void transform::TransformState::forgetValueMapping(
372372
dropMappingEntry(localMappings.direct, opHandle, payloadOp);
373373
dropMappingEntry(localMappings.reverse, payloadOp, opHandle);
374374

375-
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
375+
#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS
376376
// Payload IR is removed from the mapping. This invalidates the respective
377377
// iterators.
378378
localMappings.incrementTimestamp(opHandle);
@@ -452,7 +452,7 @@ transform::TransformState::replacePayloadValue(Value value, Value replacement) {
452452
// between the handles and the IR objects
453453
if (!replacement) {
454454
dropMappingEntry(mappings.values, handle, value);
455-
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
455+
#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS
456456
// Payload IR is removed from the mapping. This invalidates the respective
457457
// iterators.
458458
mappings.incrementTimestamp(handle);
@@ -804,7 +804,7 @@ checkRepeatedConsumptionInOperand(ArrayRef<T> payload,
804804
void transform::TransformState::compactOpHandles() {
805805
for (Value handle : opHandlesToCompact) {
806806
Mappings &mappings = getMapping(handle, /*allowOutOfScope=*/true);
807-
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
807+
#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS
808808
if (llvm::find(mappings.direct[handle], nullptr) !=
809809
mappings.direct[handle].end())
810810
// Payload IR is removed from the mapping. This invalidates the respective

0 commit comments

Comments
 (0)