summaryrefslogtreecommitdiff
path: root/compiler/optimizing/nodes.cc
diff options
context:
space:
mode:
author Nicolas Geoffray <ngeoffray@google.com> 2015-06-19 15:52:24 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2015-06-19 15:52:24 +0000
commit87a135e8699119c9ef99b0221acf481d7d6501d4 (patch)
treec0cb71ddac18ab10c38ffdc5e406ed5283932ca2 /compiler/optimizing/nodes.cc
parentff3fd957020f0e5cf5cc279f4bbbca3545ce8745 (diff)
parent8b20f88b0a8d1b374dd5eaae289d19734c77b8f8 (diff)
Merge "Be careful with predecessor/successor index."
Diffstat (limited to 'compiler/optimizing/nodes.cc')
-rw-r--r--compiler/optimizing/nodes.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc
index 68c197e607..01eb2d7f86 100644
--- a/compiler/optimizing/nodes.cc
+++ b/compiler/optimizing/nodes.cc
@@ -180,8 +180,9 @@ void HGraph::SplitCriticalEdge(HBasicBlock* block, HBasicBlock* successor) {
HBasicBlock* new_block = new (arena_) HBasicBlock(this, successor->GetDexPc());
AddBlock(new_block);
new_block->AddInstruction(new (arena_) HGoto());
- block->ReplaceSuccessor(successor, new_block);
- new_block->AddSuccessor(successor);
+ // Use `InsertBetween` to ensure the predecessor index and successor index of
+ // `block` and `successor` are preserved.
+ new_block->InsertBetween(block, successor);
if (successor->IsLoopHeader()) {
// If we split at a back edge boundary, make the new block the back edge.
HLoopInformation* info = successor->GetLoopInformation();