diff options
| author | 2017-12-15 13:43:20 +0000 | |
|---|---|---|
| committer | 2018-05-24 18:13:31 +0100 | |
| commit | ca210e34eac5b262a85c05e8815ab266f7f983d2 (patch) | |
| tree | b4bcbb77cc00c62b62b4c84541c40daadb89f3fe /compiler/optimizing/nodes.cc | |
| parent | e46752658eaf41c0cc818c51a3e1cd95876bac93 (diff) | |
ART: SBC: Support single exit loops with live_outs.
Support copying subgraphs with a single exit and live-outs -
values which are defined inside the subgraph and have uses outside.
Test: test-art-target, test-art-host.
Test: 530-checker-peel-unroll.
Change-Id: Id06a6f08d14c6e86f6437d662e24489f955e9edf
Diffstat (limited to 'compiler/optimizing/nodes.cc')
| -rw-r--r-- | compiler/optimizing/nodes.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc index 7f78dc257e..55496602d2 100644 --- a/compiler/optimizing/nodes.cc +++ b/compiler/optimizing/nodes.cc @@ -1121,6 +1121,23 @@ void HEnvironment::RemoveAsUserOfInput(size_t index) const { user->FixUpUserRecordsAfterEnvUseRemoval(before_env_use_node); } +void HEnvironment::ReplaceInput(HInstruction* replacement, size_t index) { + const HUserRecord<HEnvironment*>& env_use_record = vregs_[index]; + HInstruction* orig_instr = env_use_record.GetInstruction(); + + DCHECK(orig_instr != replacement); + + HUseList<HEnvironment*>::iterator before_use_node = env_use_record.GetBeforeUseNode(); + // Note: fixup_end remains valid across splice_after(). + auto fixup_end = replacement->env_uses_.empty() ? replacement->env_uses_.begin() + : ++replacement->env_uses_.begin(); + replacement->env_uses_.splice_after(replacement->env_uses_.before_begin(), + env_use_record.GetInstruction()->env_uses_, + before_use_node); + replacement->FixUpUserRecordsAfterEnvUseInsertion(fixup_end); + orig_instr->FixUpUserRecordsAfterEnvUseRemoval(before_use_node); +} + HInstruction* HInstruction::GetNextDisregardingMoves() const { HInstruction* next = GetNext(); while (next != nullptr && next->IsParallelMove()) { |