Skip to content

Commit e88134b

Browse files
committed
[sil] When creating a new instruction, verify that it is compatible structurally with the provided SILLocation.
These checks used to be in the SILVerifier only so one had to drop down into the debugger to figure out where a pass actually introduced the bad location. With this change, we abort immediately in the place in the code where the problem happens allowing for one to quickly fix the problems.
1 parent 8085754 commit e88134b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

include/swift/SIL/SILBuilder.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2622,6 +2622,11 @@ class SILBuilder {
26222622
C.notifyInserted(TheInst);
26232623

26242624
#ifndef NDEBUG
2625+
// If we are inserting into a specific function (rather than a block for a
2626+
// global_addr), verify that our instruction/the associated location are in
2627+
// sync. We don't care if an instruction is used in global_addr.
2628+
if (F)
2629+
TheInst->verifyDebugInfo();
26252630
TheInst->verifyOperandOwnership();
26262631
#endif
26272632
}

0 commit comments

Comments
 (0)