[llvm-dev] Function attributes for LibFunc and its impact on GlobalsAA

Vaivaswatha Nagaraj via llvm-dev llvm-dev at lists.llvm.org
Wed Dec 2 06:07:07 PST 2015


Hi,

GlobalsAA, during propagation of mod-ref behavior in the call graph, looks
at library functions (in GlobalsAAResult::AnalyzeCallGraph:
F->isDeclaration() check), for attributes, and if the function does not
have the onlyReadsMemory attribute set, forgets it.

I noticed that library functions such as malloc/realloc do not have the
attributes doesNotAccessMemory or onlyReadsMemory respectively set
(FunctionAttrs.cpp). This leads to a loss of GlobalsAA information in the
caller (and its caller and so on). Aren't these attributes stricter than
necessary currently? I do not see why the presence of malloc/realloc in a
function needs to invalidate all mod-ref info gathered for that function so
far.

Please let me know if the question is not clear. I'll try to extract out a
simple test case from the program I'm looking at and post it, so as to have
a concrete example.

Thanks,

  - Vaivaswatha
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151202/058320db/attachment.html>


More information about the llvm-dev mailing list