Skip to content

Commit ee7226e

Browse files
committed
Get rid of preprocessor macros with NDEBUG
1 parent 6c6d420 commit ee7226e

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

lib/SILOptimizer/Differentiation/PullbackCloner.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2101,14 +2101,14 @@ static SILValue getArrayValue(ApplyInst *ai) {
21012101
auto *dti = dyn_cast<DestructureTupleInst>(use->getUser());
21022102
if (!dti)
21032103
continue;
2104-
assert(!arrayValue && "Array value already found");
2104+
DEBUG_ASSERT(!arrayValue && "Array value already found");
21052105
// The first `destructure_tuple` result is the `Array` value.
21062106
arrayValue = dti->getResult(0);
2107-
#ifdef NDEBUG
2107+
#ifndef DEBUG_ASSERT_enabled
21082108
break;
21092109
#endif
21102110
}
2111-
assert(arrayValue);
2111+
ASSERT(arrayValue);
21122112
return arrayValue;
21132113
}
21142114

@@ -2567,15 +2567,12 @@ bool PullbackCloner::Implementation::run() {
25672567
// invariants hold and then skip.
25682568
if (auto *ai = getAllocateUninitializedArrayIntrinsicElementAddress(
25692569
bbActiveValue)) {
2570-
#ifndef NDEBUG
2571-
assert(isa<PointerToAddressInst>(bbActiveValue));
2572-
2570+
ASSERT(isa<PointerToAddressInst>(bbActiveValue));
25732571
SILValue arrayValue = getArrayValue(ai);
2574-
assert(llvm::find(bbActiveValues, arrayValue) !=
2572+
ASSERT(llvm::find(bbActiveValues, arrayValue) !=
25752573
bbActiveValues.end());
2576-
assert(vjpCloner.getLoopInfo()->getLoopFor(
2574+
ASSERT(vjpCloner.getLoopInfo()->getLoopFor(
25772575
arrayValue->getParentBlock()) == loop);
2578-
#endif
25792576
LLVM_DEBUG(llvm::dbgs() << "skipping: " << bbActiveValue);
25802577
break;
25812578
}

0 commit comments

Comments
 (0)