Skip to content

Commit 61a3f14

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 d1bb98b commit 61a3f14

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

lib/SILOptimizer/Utils/ShrinkBorrowScope.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,13 @@ void ShrinkBorrowScope::findBarriers() {
298298
// At that time, it was checked that this block (along with all that
299299
// successor's other predecessors) had a terminator over which the borrow
300300
// scope could be shrunk. Shrink it now.
301-
assert(tryHoistOverInstruction(block->getTerminator()));
301+
#ifndef NDEBUG
302+
bool hoisted =
303+
#endif
304+
tryHoistOverInstruction(block->getTerminator());
305+
#ifndef NDEBUG
306+
assert(hoisted);
307+
#endif
302308
}
303309
SILInstruction *barrier = nullptr;
304310
while ((instruction = instruction->getPreviousInstruction())) {

test/SILOptimizer/shrink_borrow_scope.sil

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
// RUN: %target-sil-opt -copy-propagation -enable-sil-verify-all %s | %FileCheck %s
22

3-
// REQUIRES: rdar_86809882
4-
53
import Builtin
64
import Swift
75

0 commit comments

Comments
 (0)