diff options
author | 2025-01-17 11:52:54 +0000 | |
---|---|---|
committer | 2025-01-17 05:57:44 -0800 | |
commit | 564ffff5b472f3a2dc38c2ab51a78f2d0e3f7ea8 (patch) | |
tree | 9efdcdeb41b9778a00b1fcd2256d09d1dea32646 /compiler/optimizing/nodes.cc | |
parent | f5cca5b0592fdb9ecc836dc9158ba5d63e0c1c05 (diff) |
Optimizing: Fix `InsertInputAt()`.
Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Change-Id: I500faee42b02dbc72474e30fa2a3c0388ae86674
Diffstat (limited to 'compiler/optimizing/nodes.cc')
-rw-r--r-- | compiler/optimizing/nodes.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc index fc7d0a52ab..ece11435db 100644 --- a/compiler/optimizing/nodes.cc +++ b/compiler/optimizing/nodes.cc @@ -1541,12 +1541,14 @@ void HVariableInputSizeInstruction::AddInput(HInstruction* input) { void HVariableInputSizeInstruction::InsertInputAt(size_t index, HInstruction* input) { inputs_.insert(inputs_.begin() + index, HUserRecord<HInstruction*>(input)); - input->AddUseAt(this, index); // Update indexes in use nodes of inputs that have been pushed further back by the insert(). for (size_t i = index + 1u, e = inputs_.size(); i < e; ++i) { DCHECK_EQ(inputs_[i].GetUseNode()->GetIndex(), i - 1u); inputs_[i].GetUseNode()->SetIndex(i); } + // Add the use after updating the indexes. If the `input` is already used by `this`, + // the fixup after use insertion can use those indexes. + input->AddUseAt(this, index); } void HVariableInputSizeInstruction::RemoveInputAt(size_t index) { |