diff options
author | 2023-08-18 11:47:43 +0100 | |
---|---|---|
committer | 2023-08-18 13:28:48 +0000 | |
commit | 5655ec289c3ffd389a02108e2e601b16a9dedbd4 (patch) | |
tree | 25606c445ba529b56a448ef55b67387e341c61f3 /compiler/optimizing | |
parent | 4617cc65933921f40b8dd09ad630850a984486c7 (diff) |
An instruction cannot be found before itself
If we call FoundBefore with the same instruction in both parameters,
we will return true instead of false. By swapping the two ifs
inside the for, we can achieve what we want.
FoundBefore is used to sort in code sinking, and otherwise we
would be not be covering irreflexivity so we wouldn't be having a
strict weak ordering.
Bug: 296538046
Test: art/test/testrunner/testrunner.py --host --64 -b --optimizing
Change-Id: I0abab631842ed5e1442437608aaa16c106fe37a8
Diffstat (limited to 'compiler/optimizing')
-rw-r--r-- | compiler/optimizing/nodes.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc index 0d78771bf4..2b7e384f34 100644 --- a/compiler/optimizing/nodes.cc +++ b/compiler/optimizing/nodes.cc @@ -1489,12 +1489,12 @@ bool HInstructionList::FoundBefore(const HInstruction* instruction1, const HInstruction* instruction2) const { DCHECK_EQ(instruction1->GetBlock(), instruction2->GetBlock()); for (HInstructionIterator it(*this); !it.Done(); it.Advance()) { - if (it.Current() == instruction1) { - return true; - } if (it.Current() == instruction2) { return false; } + if (it.Current() == instruction1) { + return true; + } } LOG(FATAL) << "Did not find an order between two instructions of the same block."; UNREACHABLE(); |