[Hexagon] Avoid creating an empty target feature

If the CPU string is empty, the target feature map may end up having
an empty string inserted to it. The symptom of the problem is a warning
message:
  '+' is not a recognized feature for this target (ignoring feature)
Also, the target-features attribute in the module will have an empty
string in it.
This commit is contained in:
Krzysztof Parzyszek 2020-08-10 10:32:38 -05:00
parent 0b7f125219
commit 7406eb4f6a
2 changed files with 6 additions and 1 deletions

View File

@ -98,7 +98,8 @@ bool HexagonTargetInfo::initFeatureMap(
StringRef CPUFeature = CPU;
CPUFeature.consume_front("hexagon");
CPUFeature.consume_back("t");
Features[CPUFeature] = true;
if (!CPUFeature.empty())
Features[CPUFeature] = true;
Features["long-calls"] = false;

View File

@ -0,0 +1,4 @@
// RUN: %clang_cc1 %s -triple hexagon-unknown-elf -emit-llvm -o - 2>&1 | FileCheck %s
// CHECK-NOT: '+' is not a recognized feature for this target
// Empty