[PATCH] D49162: [Inliner] Teach inliner to merge 'min-legal-vector-width' function attribute
Phabricator via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 24 11:49:21 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL337844: [Inliner] Teach inliner to merge 'min-legal-vector-width' function attribute (authored by ctopper, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D49162?vs=157081&id=157094#toc
Repository:
rL LLVM
https://reviews.llvm.org/D49162
Files:
llvm/trunk/include/llvm/IR/Attributes.td
llvm/trunk/lib/IR/Attributes.cpp
Index: llvm/trunk/include/llvm/IR/Attributes.td
===================================================================
--- llvm/trunk/include/llvm/IR/Attributes.td
+++ llvm/trunk/include/llvm/IR/Attributes.td
@@ -235,3 +235,4 @@
def : MergeRule<"adjustCallerSSPLevel">;
def : MergeRule<"adjustCallerStackProbes">;
def : MergeRule<"adjustCallerStackProbeSize">;
+def : MergeRule<"adjustMinLegalVectorWidth">;
Index: llvm/trunk/lib/IR/Attributes.cpp
===================================================================
--- llvm/trunk/lib/IR/Attributes.cpp
+++ llvm/trunk/lib/IR/Attributes.cpp
@@ -1682,6 +1682,33 @@
}
}
+/// If the inlined function defines a min legal vector width, then ensure
+/// the calling function has the same or larger min legal vector width. This
+/// function is called after the inlining decision has been made so we have to
+/// merge the attribute this way. Heuristics that would use
+/// min-legal-vector-width to determine inline compatibility would need to be
+/// handled as part of inline cost analysis.
+static void
+adjustMinLegalVectorWidth(Function &Caller, const Function &Callee) {
+ if (Callee.hasFnAttribute("min-legal-vector-width")) {
+ uint64_t CalleeVectorWidth;
+ Callee.getFnAttribute("min-legal-vector-width")
+ .getValueAsString()
+ .getAsInteger(0, CalleeVectorWidth);
+ if (Caller.hasFnAttribute("min-legal-vector-width")) {
+ uint64_t CallerVectorWidth;
+ Caller.getFnAttribute("min-legal-vector-width")
+ .getValueAsString()
+ .getAsInteger(0, CallerVectorWidth);
+ if (CallerVectorWidth < CalleeVectorWidth) {
+ Caller.addFnAttr(Callee.getFnAttribute("min-legal-vector-width"));
+ }
+ } else {
+ Caller.addFnAttr(Callee.getFnAttribute("min-legal-vector-width"));
+ }
+ }
+}
+
#define GET_ATTR_COMPAT_FUNC
#include "AttributesCompatFunc.inc"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49162.157094.patch
Type: text/x-patch
Size: 1893 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180724/d06d89ef/attachment.bin>
More information about the llvm-commits
mailing list