Skip to content
This repository was archived by the owner on Nov 1, 2021. It is now read-only.

Commit 32810ec

Browse files
committed
apply switch-related phi changes after illegal phis were erased
1 parent 8a59de4 commit 32810ec

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

lib/Target/JSBackend/ExpandI64.cpp

+8-8
Original file line numberDiff line numberDiff line change
@@ -1096,7 +1096,14 @@ bool ExpandI64::runOnModule(Module &M) {
10961096
PN->dropAllReferences();
10971097
}
10981098

1099-
// Apply basic block changes to phis, now that phis are all processed
1099+
// Delete instructions which were replaced. We do this after the full walk
1100+
// of the instructions so that all uses are replaced first.
1101+
while (!Dead.empty()) {
1102+
Instruction *D = Dead.pop_back_val();
1103+
D->eraseFromParent();
1104+
}
1105+
1106+
// Apply basic block changes to phis, now that phis are all processed (and illegal phis erased)
11001107
for (unsigned i = 0; i < PhiBlockChanges.size(); i++) {
11011108
PhiBlockChange &Change = PhiBlockChanges[i];
11021109
for (BasicBlock::iterator I = Change.DD->begin(); I != Change.DD->end(); ++I) {
@@ -1108,13 +1115,6 @@ bool ExpandI64::runOnModule(Module &M) {
11081115
}
11091116
}
11101117

1111-
// Delete instructions which were replaced. We do this after the full walk
1112-
// of the instructions so that all uses are replaced first.
1113-
while (!Dead.empty()) {
1114-
Instruction *D = Dead.pop_back_val();
1115-
D->eraseFromParent();
1116-
}
1117-
11181118
// We only visited blocks found by a DFS walk from the entry, so we haven't
11191119
// visited any unreachable blocks, and they may still contain illegal
11201120
// instructions at this point. Being unreachable, they can simply be deleted.

0 commit comments

Comments
 (0)