diff options
author | 2025-02-07 14:25:40 +0000 | |
---|---|---|
committer | 2025-02-10 03:54:00 -0800 | |
commit | 1c2039372b49e31a2d0558d1ce4934eba9c6f221 (patch) | |
tree | c5be7e181562d601ca0844041f9093738b786537 /compiler/optimizing | |
parent | 6ebd0862f7f91b8ff7c6ba4d3082474940893434 (diff) |
Optimize RemoveInstruction
We can skip two ifs as they are implied from previous ifs.
Test: art/test/testrunner/testrunner.py --host --64 -b --optimizing
Change-Id: Ia6088887832117791b82b07a2c31d2f9b8bf8b58
Diffstat (limited to 'compiler/optimizing')
-rw-r--r-- | compiler/optimizing/nodes.cc | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc index ece11435db..8044a86338 100644 --- a/compiler/optimizing/nodes.cc +++ b/compiler/optimizing/nodes.cc @@ -1332,17 +1332,19 @@ void HInstructionList::InsertInstructionAfter(HInstruction* instruction, HInstru } void HInstructionList::RemoveInstruction(HInstruction* instruction) { - if (instruction->previous_ != nullptr) { - instruction->previous_->next_ = instruction->next_; - } - if (instruction->next_ != nullptr) { - instruction->next_->previous_ = instruction->previous_; - } + DCHECK_EQ(instruction->previous_ == nullptr, instruction == first_instruction_); + DCHECK_EQ(instruction->next_ == nullptr, instruction == last_instruction_); + if (instruction == first_instruction_) { first_instruction_ = instruction->next_; + } else { + instruction->previous_->next_ = instruction->next_; } + if (instruction == last_instruction_) { last_instruction_ = instruction->previous_; + } else { + instruction->next_->previous_ = instruction->previous_; } } |