[PATCH] D21645: [CFLAA] Propagate StratifiedAttrs from callee to caller

Jia Chen via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 23 09:10:10 PDT 2016


grievejia created this revision.
grievejia added reviewers: george.burgess.iv, hfinkel.
grievejia added a subscriber: llvm-commits.

This patch adds yet another entry in CFLAAResult::FunctionInfo that keeps track of what StratifiedAttrs we should  propagate for those InterfaceValues. This is crucial for the soundness of the analysis since otherwise the caller won't be able to know if the arguments they pass to the callee will escape/alias globals/alias unknown pointers or not. 

Previously, anything below the arguments of the callee is marked with "AttrUnknown". This is too conservative, because although the callee doesn't know what's below those arguments, the caller has a perfect idea. It would be nice to distinguish between "things the caller knows but the callee doesn't" and "things that both caller and callee don't know". In this patch, we introduce another StratifiedAttr called "AttrCaller" to represent the former case, and let "AttrUnknown" to represent only the latter case. We also handle these two attributes differently in our interprocedural analysis: AttrUnknown needs to be propagated to the caller, while AttrCaller doesn't have to. 

In addition to AttrUnknown, AttrEscaped and AttrGlobal are also propagated. Those are the three attributes that I think are meaningful to the caller. 

With this patch I am finally able to turn the last two remaining xfail test cases into xpass. Yay!

http://reviews.llvm.org/D21645

Files:
  lib/Analysis/CFLAliasAnalysis.cpp
  lib/Analysis/StratifiedSets.h
  test/Analysis/CFLAliasAnalysis/interproc-arg-deref-escape.ll
  test/Analysis/CFLAliasAnalysis/interproc-arg-escape.ll
  test/Analysis/CFLAliasAnalysis/interproc-ret-escape.ll
  test/Analysis/CFLAliasAnalysis/interproc-ret-unknown.ll
  test/Analysis/CFLAliasAnalysis/interproc-store-arg-unknown.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21645.61683.patch
Type: text/x-patch
Size: 18393 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160623/4b924065/attachment.bin>


More information about the llvm-commits mailing list