summaryrefslogtreecommitdiff
path: root/compiler/optimizing/optimizing_unit_test.h
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2025-01-22 15:34:37 +0000
committer VladimĂ­r Marko <vmarko@google.com> 2025-01-23 01:11:00 -0800
commit1bf1220ef5a723793035e7f21d708d3201842959 (patch)
treeb01f3e97498200925b085789f00b18beda09c365 /compiler/optimizing/optimizing_unit_test.h
parentd661c115a57277e64e8225d2d69629635f7d4e3a (diff)
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
Diffstat (limited to 'compiler/optimizing/optimizing_unit_test.h')
-rw-r--r--compiler/optimizing/optimizing_unit_test.h16
1 files changed, 16 insertions, 0 deletions
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<HBasicBlock*> expected) {
+ return RangeEquals(block->GetPredecessors(), expected);
+ }
+
+ static bool InputsEqual(HInstruction* instruction,
+ std::initializer_list<HInstruction*> 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 <typename Range, typename ElementType>
+ static bool RangeEquals(Range&& range, std::initializer_list<ElementType> expected) {
+ return std::distance(range.begin(), range.end()) == expected.size() &&
+ std::equal(range.begin(), range.end(), expected.begin());
+ }
+
std::vector<std::unique_ptr<const StandardDexFile>> dex_files_;
std::unique_ptr<ArenaPoolAndAllocator> pool_and_allocator_;