From 0e412df13e95fa25d273c59327d6c4c6cfdaa735 Mon Sep 17 00:00:00 2001 From: Andrew Luo Date: Thu, 12 Jan 2023 10:32:49 -0800 Subject: [PATCH 1/3] arm cpu is cpu --- src/target/parsers/aprofile.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/target/parsers/aprofile.cc b/src/target/parsers/aprofile.cc index 2fd5fe71e617..6b0712461026 100644 --- a/src/target/parsers/aprofile.cc +++ b/src/target/parsers/aprofile.cc @@ -134,15 +134,17 @@ static TargetFeatures GetFeatures(TargetJSON target) { } static Array MergeKeys(Optional> existing_keys) { - const String kExtraKey = "arm_cpu"; + const Array kExtraKeys = {"arm_cpu", "cpu"}; if (!existing_keys) { - return {kExtraKey}; + return kExtraKeys; } Array keys = existing_keys.value(); - if (std::find(keys.begin(), keys.end(), kExtraKey) == keys.end()) { - keys.push_back(kExtraKey); + for (String key : kExtraKeys) { + if (std::find(keys.begin(), keys.end(), key) == keys.end()) { + keys.push_back(key); + } } return keys; } From 87b1486b98249cd682df41f8e4d5cfb0adff2ba6 Mon Sep 17 00:00:00 2001 From: Andrew Luo Date: Thu, 12 Jan 2023 10:48:57 -0800 Subject: [PATCH 2/3] init commit --- tests/cpp/target/parsers/aprofile_test.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/cpp/target/parsers/aprofile_test.cc b/tests/cpp/target/parsers/aprofile_test.cc index 0382e7a84bd7..ebd760726247 100644 --- a/tests/cpp/target/parsers/aprofile_test.cc +++ b/tests/cpp/target/parsers/aprofile_test.cc @@ -49,7 +49,9 @@ TEST(AProfileParser, ParseTargetKeys) { TargetJSON target = ParseTarget({}); Array keys = Downcast>(target.at("keys")); ASSERT_EQ(keys.size(), 1); + ASSERT_EQ(keys.size(), 2); ASSERT_EQ(keys[0], "arm_cpu"); + ASSERT_EQ(keys[1], "cpu"); } TEST(AProfileParser, ParseTargetWithExistingKeys) { From b69bd22628b2ccc610fec6cf3e84a316181d464a Mon Sep 17 00:00:00 2001 From: Andrew Luo Date: Thu, 12 Jan 2023 11:07:51 -0800 Subject: [PATCH 3/3] fix test --- tests/cpp/target/parsers/aprofile_test.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/cpp/target/parsers/aprofile_test.cc b/tests/cpp/target/parsers/aprofile_test.cc index ebd760726247..ffbc5fd431a7 100644 --- a/tests/cpp/target/parsers/aprofile_test.cc +++ b/tests/cpp/target/parsers/aprofile_test.cc @@ -48,7 +48,6 @@ static TargetFeatures ParseTargetWithAttrs(String mcpu, String mtriple, Array keys = Downcast>(target.at("keys")); - ASSERT_EQ(keys.size(), 1); ASSERT_EQ(keys.size(), 2); ASSERT_EQ(keys[0], "arm_cpu"); ASSERT_EQ(keys[1], "cpu");