aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2014-03-24 10:36:42 -0700
committerAlon Zakai <alonzakai@gmail.com>2014-03-24 10:36:42 -0700
commit32810ec3416c24f7e1c3467b485a2b4474389ecf (patch)
treec26fbdc67ce92542c9ddafb2966defe2ccb95543 /lib
parent8a59de408a576ae41a16837bb82bae5b51aebca1 (diff)
apply switch-related phi changes after illegal phis were erased
Diffstat (limited to 'lib')
-rw-r--r--lib/Target/JSBackend/ExpandI64.cpp16
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.