[PATCH] D77952: [TLI] Reduce copies for TLI and TLA

Teresa Johnson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Apr 11 14:56:15 PDT 2020


tejohnson added a comment.

Some parts of this are dependent on the patch that got reverted, but I have some other questions below about the changes in BackendUtil.cpp.



================
Comment at: clang/lib/CodeGen/BackendUtil.cpp:689
   // Set up the per-function pass manager.
-  FPM.add(new TargetLibraryInfoWrapperPass(*TLII));
+  FPM.add(new TargetLibraryInfoWrapperPass(TargetTriple));
   if (CodeGenOpts.VerifyModule)
----------------
These changes mean we now construct a new TLII multiple times (e.g. both when we add the TargetLibraryInfoWrapperPass to the MPM earlier and to the FPM here, rather that just copying. Is this actually faster? It seems like it would be slower overall.


================
Comment at: llvm/lib/Analysis/TargetLibraryInfo.cpp:586
             AvailableArray);
-  for (unsigned i = 0; i < NumVecLibs; i++)
-    VecLibDescs[i] = TLI.VecLibDescs[i];
+  std::move(std::begin(TLI.VecLibDescs), std::end(TLI.VecLibDescs),
+            VecLibDescs);
----------------
Woops, sorry, missed this one in the original review.


================
Comment at: llvm/lib/Analysis/TargetLibraryInfo.cpp:596
   memcpy(AvailableArray, TLI.AvailableArray, sizeof(AvailableArray));
   return *this;
 }
----------------
This is missing copying of the VecLibDescs (looks like I missed this as well originally).


================
Comment at: llvm/lib/Analysis/TargetLibraryInfo.cpp:606
             AvailableArray);
   return *this;
 }
----------------
Ditto.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77952/new/

https://reviews.llvm.org/D77952





More information about the cfe-commits mailing list