Skip to content

Commit 90995b8

Browse files
committed
Teach the SIL verifier to enforce stronger rules around
edges into dead-end regions. - Only treat edges *into* dead-end regions as special; edges internal the region must use the normal rules. - Conservatively merge information along those edges rather than just picking one at random. This requires us to not walk into the region until we've processed all of the edges to it. - Make sure we prevent *any* stack allocations from being deallocated if the stack is inconsistent entering a block. Additionally, fix a bug which was incorrectly treating all blocks that don't themselves exit the function as ultimately leading to unreachable, which had inadvertently largely turned off the consistency check.
1 parent c610727 commit 90995b8

File tree

6 files changed

+688
-121
lines changed

6 files changed

+688
-121
lines changed

include/swift/SIL/SILModule.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
#include "llvm/ADT/MapVector.h"
4747
#include "llvm/ADT/PointerIntPair.h"
4848
#include "llvm/ADT/SetVector.h"
49+
#include "llvm/ADT/STLFunctionalExtras.h"
4950
#include "llvm/ADT/ilist.h"
5051
#include "llvm/ProfileData/InstrProfReader.h"
5152
#include "llvm/Support/Allocator.h"
@@ -1144,7 +1145,7 @@ inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const SILModule &M){
11441145
void verificationFailure(const Twine &complaint,
11451146
const SILInstruction *atInstruction,
11461147
const SILArgument *atArgument,
1147-
const std::function<void()> &extraContext);
1148+
llvm::function_ref<void(llvm::raw_ostream &OS)> extraContext);
11481149

11491150
inline bool SILOptions::supportsLexicalLifetimes(const SILModule &mod) const {
11501151
switch (mod.getStage()) {

0 commit comments

Comments
 (0)