[llvm] [TLI] Add getLibFunc in TLI API that accepts an Instruction. (PR #75919)

Paul Walker via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 20 03:58:50 PST 2023


================
@@ -621,3 +621,44 @@ TEST_F(TargetLibraryInfoTest, ValidProto) {
     EXPECT_TRUE(isLibFunc(F, LF));
   }
 }
+
+namespace {
+
+/// Creates TLI for AArch64 and uses it to get the LibFunc names for the FRem
+/// Instruction.
+class TLITestAarch64 : public ::testing::Test {
+private:
+  const Triple TargetTriple;
+
+protected:
+  LLVMContext Ctx;
+  std::unique_ptr<TargetLibraryInfoImpl> TLII;
+  std::unique_ptr<TargetLibraryInfo> TLI;
+
+  /// Create TLI for AArch64
+  TLITestAarch64() : TargetTriple(Triple("aarch64-unknown-linux-gnu")) {
+    TLII = std::make_unique<TargetLibraryInfoImpl>(
+        TargetLibraryInfoImpl(TargetTriple));
+    TLII->addVectorizableFunctionsFromVecLib(TargetLibraryInfoImpl::NoLibrary,
+                                             TargetTriple);
----------------
paulwalker-arm wrote:

Is this necessary? I would have thought TLI can exist without needing to add vector mappings.

https://github.com/llvm/llvm-project/pull/75919


More information about the llvm-commits mailing list