[PATCH] D35633: [ThinLTO] Add FunctionAttr NoRecurse and ReadAttr propagation to ThinLTO
Charles Saternos via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 21 06:51:25 PDT 2017
ncharlie added inline comments.
================
Comment at: lib/Transforms/IPO/FunctionImport.cpp:445
+ if (!S->fflags().NoRecurse ||
+ S->getOriginalName() == F->getOriginalName())
+ return false;
----------------
mehdi_amini wrote:
> Not sure why the second condition is needed?
I copied that out of the original FunctionAttrs pass to prevent the function from being marked NoRecurse if it calls itself (http://llvm-cs.pcc.me.uk/lib/Transforms/IPO/FunctionAttrs.cpp#1068).
================
Comment at: lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp:443
+ FS->updateCallGraphEdgeMAK(P.first->getGUID(), P.second);
+ }
+ }
----------------
mehdi_amini wrote:
> Why do we need to mark the edges?
I was planning on using that to propagate read attrs up to the caller. For instance:
```
void x(int *k) { // can't mark readonly since k could be global
*k++;
}
void j() {
int i = 5;
x(&i); // since i is local memory, we can mark j as readnone
}
```
I'm currently working on implementing this - when I finish I'll update the patch.
https://reviews.llvm.org/D35633
More information about the llvm-commits
mailing list