diff options
| author | 2025-02-10 04:21:39 -0800 | |
|---|---|---|
| committer | 2025-02-10 04:21:39 -0800 | |
| commit | 171f8c42df9e1a67084dbb1737b8176d08c794f2 (patch) | |
| tree | c5be7e181562d601ca0844041f9093738b786537 /compiler/optimizing | |
| parent | 7bee5a748d55002f7a62483442561c0960e84fcf (diff) | |
| parent | 1c2039372b49e31a2d0558d1ce4934eba9c6f221 (diff) | |
Optimize RemoveInstruction am: 1c2039372b
Original change: https://android-review.googlesource.com/c/platform/art/+/3482654
Change-Id: Ib68f8daf7d6cc894caa63447083367a7bb322e8e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
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_; } } |