[PATCH] D31787: [TLI] Add declarations for various math header file routines from math-finite.h that create '__<func>_finite as functions

Chris Chrulski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 8 09:18:24 PDT 2017


chrischr added a comment.

@ Andrew: New files uploaded for additional testing for function prototype matching. Although for the TargetLibraryInfo.def, test coverage should be coming about from the unittests/Analysis/TargetLibraryInfoTest.cpp test case, since this verifies that every function listed in the .def file gets matched against the definition in this test case.

@ ab: I looked back at the TargetLibraryInfo code, but don't see any support for indicating function aliases there. However, I don't think it would be desirable to map them to be the same as the non-finite version, because while during some of the optimization phases they need to be treated similarly, when it comes to the code generation phase they need to be treated uniquely to call either the regular version or the finite version to get the optimized library version.



================
Comment at: include/llvm/Analysis/TargetLibraryInfo.def:165
+/// double __acos_finite(double x);
+TLI_DEFINE_ENUM_INTERNAL(acos_finite)
+TLI_DEFINE_STRING_INTERNAL("__acos_finite")
----------------
andrew.w.kaylor wrote:
> chrischr wrote:
> > andrew.w.kaylor wrote:
> > > Is there a reason for these being inserted where they are?  It looks rather arbitrary.
> > The list needs to be created in sorted order based on the value of the string definition.
> > 
> > 
> > ```
> > static void initialize(TargetLibraryInfoImpl &TLI, const Triple &T,
> >                        ArrayRef<StringRef> StandardNames) {
> >   // Verify that the StandardNames array is in alphabetical order.
> >   assert(std::is_sorted(StandardNames.begin(), StandardNames.end(),
> >                         [](StringRef LHS, StringRef RHS) {
> >                           return LHS < RHS;
> >                         }) &&
> >          "TargetLibraryInfoImpl function names must be sorted");
> > ```
> > 
> OK.  That makes sense now.
> 
> What about a test?
BTW, the test. unittests/Analysis/TargetLibraryInfoTest.cpp. checks that every function in the TLI table can be looked up.


https://reviews.llvm.org/D31787





More information about the llvm-commits mailing list