From 1bf1220ef5a723793035e7f21d708d3201842959 Mon Sep 17 00:00:00 2001 From: Vladimir Marko Date: Wed, 22 Jan 2025 15:34:37 +0000 Subject: Optimizing: Generate `HSelect` if there are more phis... ... as long as they have identical inputs at the relevant indexes. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: I40168de61d2dfe1143786a2e4a27549cc54b0451 --- compiler/optimizing/optimizing_unit_test.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'compiler/optimizing/optimizing_unit_test.h') diff --git a/compiler/optimizing/optimizing_unit_test.h b/compiler/optimizing/optimizing_unit_test.h index 21998b19da..d81f3804dc 100644 --- a/compiler/optimizing/optimizing_unit_test.h +++ b/compiler/optimizing/optimizing_unit_test.h @@ -957,6 +957,16 @@ class OptimizingUnitTestHelper { return val; } + static bool PredecessorsEqual(HBasicBlock* block, + std::initializer_list expected) { + return RangeEquals(block->GetPredecessors(), expected); + } + + static bool InputsEqual(HInstruction* instruction, + std::initializer_list expected) { + return RangeEquals(instruction->GetInputs(), expected); + } + // Returns if the `instruction` is removed from the graph. static inline bool IsRemoved(HInstruction* instruction) { return instruction->GetBlock() == nullptr; @@ -975,6 +985,12 @@ class OptimizingUnitTestHelper { return checker.IsValid(); } + template + static bool RangeEquals(Range&& range, std::initializer_list expected) { + return std::distance(range.begin(), range.end()) == expected.size() && + std::equal(range.begin(), range.end(), expected.begin()); + } + std::vector> dex_files_; std::unique_ptr pool_and_allocator_; -- cgit v1.2.3-59-g8ed1b