[PATCH] [FunctionAttr] Infer nonnull attributes on returns

Philip Reames listmail at philipreames.com
Mon May 11 16:48:48 PDT 2015


Hi nlewycky, pete, hfinkel,

Teach FunctionAttr to infer the nonnull attribute on return values of functions which never return a potentially null value.  This is done both via a conservative local analysis for the function itself and a optimistic per-SCC analysis.  If no function in the SCC returns anything which could be null (other than values from other functions in the SCC), we can conclude no function returned a null pointer.  Even if some function within the SCC returns a null pointer, we may be able to locally conclude that some don't.  

This is inspired by discussion on http://reviews.llvm.org/D9132, but is mostly orthogonal to that patch except that they both relate to nonnul attributes.

http://reviews.llvm.org/D9688

Files:
  lib/Transforms/IPO/FunctionAttrs.cpp
  test/Transforms/FunctionAttrs/nonnull.ll

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D9688.25527.patch
Type: text/x-patch
Size: 8931 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150511/9e38ad83/attachment.bin>


More information about the llvm-commits mailing list