[PATCH] D15499: Add AlmostReadNone and AlmostArgMemOnly attributes and set it for a few libc functions. Enhance GlobalsAA

Vaivaswatha Nagaraj via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 14 08:33:43 PST 2015


vaivaswatha created this revision.
vaivaswatha added reviewers: hfinkel, jmolloy.
vaivaswatha added a subscriber: llvm-commits.
vaivaswatha set the repository for this revision to rL LLVM.

This patch introduces two new function attributes 
- AlmostReadNone: Does not read memory, except may be for globals that are not visible to the IR being compiled.
- AlmostArgMemOnly: Does not read memory, except may be for globals that are not visible to the IR being compiled, or memory pointed to by pointer arguments.

As a sample, few libc functions have these attributes set.

To take advantage of these two attributes, GlobalsAA is modified to understand that functions with these two attributes do not access any known global (i.e., a global visible to the IR being compiled).

On a side note, "__mulsc3" (call generated by clang, and function defined in compiler-rt) and "exit" are added to the list of known functions. 

Repository:
  rL LLVM

http://reviews.llvm.org/D15499

Files:
  include/llvm/Analysis/TargetLibraryInfo.def
  include/llvm/Bitcode/LLVMBitCodes.h
  include/llvm/IR/Attributes.td
  include/llvm/IR/Function.h
  lib/Analysis/GlobalsModRef.cpp
  lib/Bitcode/Writer/BitcodeWriter.cpp
  lib/IR/Attributes.cpp
  lib/Transforms/IPO/FunctionAttrs.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15499.42726.patch
Type: text/x-patch
Size: 8708 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151214/42bcfed4/attachment.bin>


More information about the llvm-commits mailing list