forked from OSchip/llvm-project
NFC: Avoid redundant checks for vector-function-abi-variant attribute
Updated the comments on the code as well to reflect what the preconditions on VFABI::getVectorVariantNames are.
This commit is contained in:
parent
064e9907ba
commit
0ab3ba230e
|
@ -180,7 +180,10 @@ VFParamKind getVFParamKindFromString(const StringRef Token);
|
||||||
static constexpr char const *MappingsAttrName = "vector-function-abi-variant";
|
static constexpr char const *MappingsAttrName = "vector-function-abi-variant";
|
||||||
|
|
||||||
/// Populates a set of strings representing the Vector Function ABI variants
|
/// Populates a set of strings representing the Vector Function ABI variants
|
||||||
/// associated to the CallInst CI.
|
/// associated to the CallInst CI. If the CI does not contain the
|
||||||
|
/// vector-function-abi-variant attribute, we return without populating
|
||||||
|
/// VariantMappings, i.e. callers of getVectorVariantNames need not check for
|
||||||
|
/// the presence of the attribute (see InjectTLIMappings).
|
||||||
void getVectorVariantNames(const CallInst &CI,
|
void getVectorVariantNames(const CallInst &CI,
|
||||||
SmallVectorImpl<std::string> &VariantMappings);
|
SmallVectorImpl<std::string> &VariantMappings);
|
||||||
} // end namespace VFABI
|
} // end namespace VFABI
|
||||||
|
@ -203,14 +206,13 @@ class VFDatabase {
|
||||||
static void getVFABIMappings(const CallInst &CI,
|
static void getVFABIMappings(const CallInst &CI,
|
||||||
SmallVectorImpl<VFInfo> &Mappings) {
|
SmallVectorImpl<VFInfo> &Mappings) {
|
||||||
const StringRef ScalarName = CI.getCalledFunction()->getName();
|
const StringRef ScalarName = CI.getCalledFunction()->getName();
|
||||||
const StringRef S =
|
|
||||||
CI.getAttribute(AttributeList::FunctionIndex, VFABI::MappingsAttrName)
|
|
||||||
.getValueAsString();
|
|
||||||
if (S.empty())
|
|
||||||
return;
|
|
||||||
|
|
||||||
SmallVector<std::string, 8> ListOfStrings;
|
SmallVector<std::string, 8> ListOfStrings;
|
||||||
|
// The check for the vector-function-abi-variant attribute is done when
|
||||||
|
// retrieving the vector variant names here.
|
||||||
VFABI::getVectorVariantNames(CI, ListOfStrings);
|
VFABI::getVectorVariantNames(CI, ListOfStrings);
|
||||||
|
if (ListOfStrings.empty())
|
||||||
|
return;
|
||||||
for (const auto &MangledName : ListOfStrings) {
|
for (const auto &MangledName : ListOfStrings) {
|
||||||
const Optional<VFInfo> Shape =
|
const Optional<VFInfo> Shape =
|
||||||
VFABI::tryDemangleForVFABI(MangledName, *(CI.getModule()));
|
VFABI::tryDemangleForVFABI(MangledName, *(CI.getModule()));
|
||||||
|
|
Loading…
Reference in New Issue