[llvm] 0ab3ba2 - NFC: Avoid redundant checks for vector-function-abi-variant attribute
Anna Thomas via llvm-commits
llvm-commits at lists.llvm.org
Wed May 13 10:29:53 PDT 2020
Author: Anna Thomas
Date: 2020-05-13T13:29:48-04:00
New Revision: 0ab3ba230e928e8e1261e36c805de87b5d44e20d
URL: https://github.com/llvm/llvm-project/commit/0ab3ba230e928e8e1261e36c805de87b5d44e20d
DIFF: https://github.com/llvm/llvm-project/commit/0ab3ba230e928e8e1261e36c805de87b5d44e20d.diff
LOG: 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.
Added:
Modified:
llvm/include/llvm/Analysis/VectorUtils.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/Analysis/VectorUtils.h b/llvm/include/llvm/Analysis/VectorUtils.h
index 66c68be5b6cb..2c28503743cd 100644
--- a/llvm/include/llvm/Analysis/VectorUtils.h
+++ b/llvm/include/llvm/Analysis/VectorUtils.h
@@ -180,7 +180,10 @@ VFParamKind getVFParamKindFromString(const StringRef Token);
static constexpr char const *MappingsAttrName = "vector-function-abi-variant";
/// 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,
SmallVectorImpl<std::string> &VariantMappings);
} // end namespace VFABI
@@ -203,14 +206,13 @@ class VFDatabase {
static void getVFABIMappings(const CallInst &CI,
SmallVectorImpl<VFInfo> &Mappings) {
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;
+ // The check for the vector-function-abi-variant attribute is done when
+ // retrieving the vector variant names here.
VFABI::getVectorVariantNames(CI, ListOfStrings);
+ if (ListOfStrings.empty())
+ return;
for (const auto &MangledName : ListOfStrings) {
const Optional<VFInfo> Shape =
VFABI::tryDemangleForVFABI(MangledName, *(CI.getModule()));
More information about the llvm-commits
mailing list