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; } diff --git a/tests/cpp/target/parsers/aprofile_test.cc b/tests/cpp/target/parsers/aprofile_test.cc index 0382e7a84bd7..ffbc5fd431a7 100644 --- a/tests/cpp/target/parsers/aprofile_test.cc +++ b/tests/cpp/target/parsers/aprofile_test.cc @@ -48,8 +48,9 @@ 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"); } TEST(AProfileParser, ParseTargetWithExistingKeys) {