diff options
Diffstat (limited to 'lib/Target/JSBackend/ExpandI64.cpp')
-rw-r--r-- | lib/Target/JSBackend/ExpandI64.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/Target/JSBackend/ExpandI64.cpp b/lib/Target/JSBackend/ExpandI64.cpp index 9929033169..1fbf0ddebd 100644 --- a/lib/Target/JSBackend/ExpandI64.cpp +++ b/lib/Target/JSBackend/ExpandI64.cpp @@ -1096,7 +1096,14 @@ bool ExpandI64::runOnModule(Module &M) { PN->dropAllReferences(); } - // Apply basic block changes to phis, now that phis are all processed + // Delete instructions which were replaced. We do this after the full walk + // of the instructions so that all uses are replaced first. + while (!Dead.empty()) { + Instruction *D = Dead.pop_back_val(); + D->eraseFromParent(); + } + + // Apply basic block changes to phis, now that phis are all processed (and illegal phis erased) for (unsigned i = 0; i < PhiBlockChanges.size(); i++) { PhiBlockChange &Change = PhiBlockChanges[i]; for (BasicBlock::iterator I = Change.DD->begin(); I != Change.DD->end(); ++I) { @@ -1108,13 +1115,6 @@ bool ExpandI64::runOnModule(Module &M) { } } - // Delete instructions which were replaced. We do this after the full walk - // of the instructions so that all uses are replaced first. - while (!Dead.empty()) { - Instruction *D = Dead.pop_back_val(); - D->eraseFromParent(); - } - // We only visited blocks found by a DFS walk from the entry, so we haven't // visited any unreachable blocks, and they may still contain illegal // instructions at this point. Being unreachable, they can simply be deleted. |