[PATCH] D36850: [ThinLTO] Add function attribute propagation

Charles Saternos via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 18 08:14:29 PDT 2017


ncharlie added inline comments.


================
Comment at: lib/LTO/LTO.cpp:1051
 
+  propagateFunctionAttrs(ThinLTO.CombinedIndex);
   StringMap<FunctionImporter::ImportMapTy> ImportLists(
----------------
I tried putting this in ThinLTOCodeGenerator::linkCombinedIndex(), but it seems like that function is only called by the thin-lto utility - it's never run by clang?


================
Comment at: lib/Transforms/IPO/FunctionImport.cpp:423
+void llvm::propagateFunctionAttrs(ModuleSummaryIndex &Index) {
+  auto addReadAttrs = [](std::vector<FunctionSummary *> &SCCNodes) {
+    bool ReadsMemory = false;
----------------
I just realized this isn't going to ever change any attrs.
 
I based it on the FunctionAttrs pass which does alias analysis first: http://llvm-cs.pcc.me.uk/lib/Transforms/IPO/FunctionAttrs.cpp#185

That can't be done here, since at this point we can only access summaries.

Maybe I need to include a flag in the function summary that marks if the function definitely writes memory and then propagate memory access information to any nodes that are unknown?


https://reviews.llvm.org/D36850





More information about the llvm-commits mailing list