Skip to content

Commit 45ad1ac

Browse files
authored
Revert "Fix LLVM_ENABLE_ABI_BREAKING_CHECKS macro check: use #if inst… (#110923)
…ead of #ifdef (#110883)" This reverts commit 1905cdb, which causes lots of failures where LLVM doesn't have the right header guards. The errors can be seen on [BuildKite](https://buildkite.com/llvm-project/upstream-bazel/builds/112362#01924eae-231c-4d06-ba87-2c538cf40e04), where the source uses `#ifndef NDEBUG`, but the content in question is defined when `LLVM_ENABLE_ABI_BREAKING_CHECKS == 1`. For example, `llvm/include/llvm/Support/GenericDomTreeConstruction.h` has the following: ```cpp // Helper struct used during edge insertions. struct InsertionInfo { // ... #ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS SmallVector<TreeNodePtr, 8> VisitedUnaffected; #endif }; // ... InsertionInfo II; // ... #ifndef NDEBUG II.VisitedUnaffected.push_back(SuccTN); #endif ```
1 parent 916e6ad commit 45ad1ac

File tree

13 files changed

+32
-32
lines changed

13 files changed

+32
-32
lines changed

llvm/include/llvm/CodeGen/SelectionDAG.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ class SelectionDAG {
584584
return Root;
585585
}
586586

587-
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
587+
#ifndef NDEBUG
588588
void VerifyDAGDivergence();
589589
#endif
590590

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/JumpThreading.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ class JumpThreadingPass : public PassInfoMixin<JumpThreadingPass> {
8989
bool ChangedSinceLastAnalysisUpdate = false;
9090
bool HasGuards = false;
9191
#ifndef LLVM_ENABLE_ABI_BREAKING_CHECKS
92-
SmallSet<AssertingVH<const BasicBlock>, 16> LoopHeaders;
93-
#else
9492
SmallPtrSet<const BasicBlock *, 16> LoopHeaders;
93+
#else
94+
SmallSet<AssertingVH<const BasicBlock>, 16> LoopHeaders;
9595
#endif
9696

9797
unsigned BBDupThreshold;

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

Lines changed: 3 additions & 3 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
}
@@ -295,7 +295,7 @@ class LPMUpdater {
295295
/// loops within them will be visited in postorder as usual for the loop pass
296296
/// manager.
297297
void addSiblingLoops(ArrayRef<Loop *> NewSibLoops) {
298-
#if LLVM_ENABLE_ABI_BREAKING_CHECKS && !defined(NDEBUG)
298+
#if defined(LLVM_ENABLE_ABI_BREAKING_CHECKS) && !defined(NDEBUG)
299299
for (Loop *NewL : NewSibLoops)
300300
assert(NewL->getParentLoop() == ParentL &&
301301
"All of the new loops must be siblings of the current loop!");
@@ -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
@@ -168,7 +168,7 @@ class SCEVExpander : public SCEVVisitor<SCEVExpander, Value *> {
168168
/// consistent when instructions are moved.
169169
SmallVector<SCEVInsertPointGuard *, 8> InsertPointGuards;
170170

171-
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
171+
#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS
172172
const char *DebugType;
173173
#endif
174174

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

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

llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11725,7 +11725,7 @@ void SelectionDAG::CreateTopologicalOrder(std::vector<SDNode *> &Order) {
1172511725
}
1172611726
}
1172711727

11728-
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
11728+
#ifndef NDEBUG
1172911729
void SelectionDAG::VerifyDAGDivergence() {
1173011730
std::vector<SDNode *> TopoOrder;
1173111731
CreateTopologicalOrder(TopoOrder);

llvm/lib/Passes/StandardInstrumentations.cpp

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

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

13971397
PIC.registerAfterPassCallback([this, &MAM](StringRef P, Any IR,
13981398
const PreservedAnalyses &PassPA) {
1399-
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
1399+
#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS
14001400
assert(PassStack.pop_back_val() == P &&
14011401
"Before and After callbacks must correspond");
14021402
#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

0 commit comments

Comments
 (0)