Skip to content

Commit dc29673

Browse files
committed
[ShrinkBorrowScope] Fixed assert.
Previously, it was asserted that hoisting over a terminator succeeded (because it is previously checked that it can be done). That was erroneously done by putting the call to hoist within an invocation of the assert macro. The result was that in release builds, the call was not made. Here, that is fixed by just calling the hoist function and, in debug builds, asserting its return. rdar://86809882
1 parent 0bf73bb commit dc29673

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/SILOptimizer/Utils/ShrinkBorrowScope.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,13 @@ void ShrinkBorrowScope::findBarriers() {
315315
// At that time, it was checked that this block (along with all that
316316
// successor's other predecessors) had a terminator over which the borrow
317317
// scope could be shrunk. Shrink it now.
318-
assert(tryHoistOverInstruction(block->getTerminator()));
318+
#ifndef NDEBUG
319+
bool hoisted =
320+
#endif
321+
tryHoistOverInstruction(block->getTerminator());
322+
#ifndef NDEBUG
323+
assert(hoisted);
324+
#endif
319325
}
320326
SILInstruction *barrier = nullptr;
321327
while ((instruction = getPreviousInstruction(instruction))) {

0 commit comments

Comments
 (0)