[X86] Optimize out a few extra strlen calls in getX86TargetCPU. NFCI
We had a conversion from const char * to StringRef and const char * to std::string conversion. These both do their own strlen call if the compiler doens't figure out how to share them. By adding the temporary StringRef we can convert it to std::string instead. The other case is to use a StringSwitch<StringRef> instead of StringSwitch<const char *> since the output values of the switch are string literals. This allows the length to be computed at compile time. Otherwise we have to convert from const char * to std::string after the StringSwitch.
Loading
Please sign in to comment