Skip to content

Commit 8cf2d90

Browse files
committed
SIL Deserializer: Assert that we don't deserialize during "lowered" stage.
Pre-IRGen lowering passes take SIL out of canonical form, making it potentially incompatible with the serialized canonical SIL.
1 parent 9793439 commit 8cf2d90

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

lib/Serialization/DeserializeSIL.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,19 @@ SILFunction *SILDeserializer::readSILFunction(DeclID FID,
387387
StringRef name,
388388
bool declarationOnly,
389389
bool errorIfEmptyBody) {
390+
// We can't deserialize function bodies after IRGen lowering passes have
391+
// happened since other definitions in the module will no longer be in
392+
// canonical SIL form.
393+
switch (SILMod.getStage()) {
394+
case SILStage::Raw:
395+
case SILStage::Canonical:
396+
break;
397+
398+
case SILStage::Lowered:
399+
llvm_unreachable("cannot deserialize into a module that has entered "
400+
"Lowered stage");
401+
}
402+
390403
if (FID == 0)
391404
return nullptr;
392405
assert(FID <= Funcs.size() && "invalid SILFunction ID");

0 commit comments

Comments
 (0)