Skip to content

Commit 66a579c

Browse files
committed
Add ModuleFile::isSIB
We can't make the same assumptions about .sib files. Ideally, we should serialize the module's stage and set WasDeserializedCanonical based on that state. However, we probably still want the IsSIB flag for assertions.
1 parent 287ccec commit 66a579c

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

include/swift/Serialization/ModuleFile.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,11 @@ class ModuleFile
8787
/// The number of entities that are currently being deserialized.
8888
unsigned NumCurrentDeserializingEntities = 0;
8989

90+
/// Is this module file actually a .sib file? .sib files are serialized SIL at
91+
/// arbitrary granularity and arbitrary stage; unlike serialized Swift
92+
/// modules, which are assumed to contain canonical SIL for an entire module.
93+
bool IsSIB = false;
94+
9095
/// RAII class to be used when deserializing an entity.
9196
class DeserializingEntityRAII {
9297
ModuleFile &MF;

lib/Serialization/DeserializeSIL.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -507,9 +507,10 @@ SILFunction *SILDeserializer::readSILFunction(DeclID FID,
507507
if (Callback) Callback->didDeserialize(MF->getAssociatedModule(), fn);
508508
}
509509
// Mark this function as deserialized. This avoids rerunning diagnostic
510-
// passes. Certain passes in the madatory pipeline may expect not to rerun
510+
// passes. Certain passes in the madatory pipeline may not work as expected
511511
// after arbitrary optimization and lowering.
512-
fn->setWasDeserializedCanonical();
512+
if (!MF->IsSIB)
513+
fn->setWasDeserializedCanonical();
513514

514515
assert(fn->empty() &&
515516
"SILFunction to be deserialized starts being empty.");

lib/Serialization/ModuleFile.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1115,6 +1115,7 @@ ModuleFile::ModuleFile(
11151115
Name = info.name;
11161116
TargetTriple = info.targetTriple;
11171117
CompatibilityVersion = info.compatibilityVersion;
1118+
IsSIB = extInfo->isSIB();
11181119

11191120
hasValidControlBlock = true;
11201121
break;

0 commit comments

Comments
 (0)