diff options
| author | 2016-04-20 18:45:25 +0100 | |
|---|---|---|
| committer | 2016-04-20 19:40:35 +0100 | |
| commit | c6b5627c25ff5653e97ccff8c5ccf6ac967b6f83 (patch) | |
| tree | 8cec0d66bdd5e5a9be14bbb881eb36d09868ab39 /compiler/optimizing/nodes.cc | |
| parent | a584db5460a31198bf621cdacf5bc304a984efa4 (diff) | |
Fix HInstruction::ReplaceInput(), allow no-op.
Allow HInstruction::ReplaceInput() to be called with
a `replacement` being the same as the old input and
do nothing in that case.
This is a follow-up to
https://android-review.googlesource.com/216923
where I erroneously assumed that it never happens.
Also adhere to the standard C++ std::forward_list<>
semantics in the single-element overload of
`IntrusiveForwardList<>::splice_after()`.
Bug: 28173563
Change-Id: I5cea14c212b1083f90ffe6b5b53324ad663d57d8
Diffstat (limited to 'compiler/optimizing/nodes.cc')
| -rw-r--r-- | compiler/optimizing/nodes.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc index 7c6e9318fb..fe75451ad2 100644 --- a/compiler/optimizing/nodes.cc +++ b/compiler/optimizing/nodes.cc @@ -1022,8 +1022,11 @@ void HInstruction::ReplaceWith(HInstruction* other) { void HInstruction::ReplaceInput(HInstruction* replacement, size_t index) { HUserRecord<HInstruction*> input_use = InputRecordAt(index); + if (input_use.GetInstruction() == replacement) { + // Nothing to do. + return; + } HUseList<HInstruction*>::iterator before_use_node = input_use.GetBeforeUseNode(); - DCHECK(input_use.GetInstruction() != replacement); // Note: fixup_end remains valid across splice_after(). auto fixup_end = replacement->uses_.empty() ? replacement->uses_.begin() : ++replacement->uses_.begin(); |