Skip to content

Commit cb33716

Browse files
author
Joe Shajrawi
committed
Set SIL stage to lowered at the *start* of address lowering
SIL is not in a consistent state during the lowering pass. We just make sure it is correct at the end of the pass. This broke PR #13283 (verifying convert_function instructions in the builder) To workaround this issue we will be running the builder’s verifier when the SIL stage != SILStage::Lowered The SIL stage is set to lowered at the end of the module pass. This means that if this is the first lowering pass said workaround would not work. This commit sets the SIL stage to lowered at the beginning of the module pass instead
1 parent 1006a6e commit cb33716

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

lib/IRGen/LoadableByAddress.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2499,11 +2499,14 @@ void LoadableByAddress::updateLoweredTypes(SILFunction *F) {
24992499

25002500
/// The entry point to this function transformation.
25012501
void LoadableByAddress::run() {
2502+
// Set the SIL state before the PassManager has a chance to run
2503+
// verification.
2504+
getModule()->setStage(SILStage::Lowered);
2505+
25022506
for (auto &F : *getModule())
25032507
runOnFunction(&F);
25042508

25052509
if (modFuncs.empty()) {
2506-
getModule()->setStage(SILStage::Lowered);
25072510
return;
25082511
}
25092512

@@ -2643,10 +2646,6 @@ void LoadableByAddress::run() {
26432646
// Fix all instructions that rely on block storage type
26442647
fixStoreToBlockStorageInstrs();
26452648

2646-
// Set the SIL state before the PassManager has a chance to run
2647-
// verification.
2648-
getModule()->setStage(SILStage::Lowered);
2649-
26502649
// Clean up the data structs:
26512650
modFuncs.clear();
26522651
conversionInstrs.clear();

0 commit comments

Comments
 (0)