diff options
author | Hal Finkel <hfinkel@anl.gov> | 2014-10-14 20:51:26 +0000 |
---|---|---|
committer | Hal Finkel <hfinkel@anl.gov> | 2014-10-14 20:51:26 +0000 |
commit | db5f86a9bf983dc0f3ea659bc1897803b8f1fd52 (patch) | |
tree | a826796844e375402c7d5c2f83727ba5d54533d5 /llvm/lib/Analysis/CFLAliasAnalysis.cpp | |
parent | 0ca42bb5a8f0e1a3290cd0bd33fdc443941b08ff (diff) | |
download | bcm5719-llvm-db5f86a9bf983dc0f3ea659bc1897803b8f1fd52.tar.gz bcm5719-llvm-db5f86a9bf983dc0f3ea659bc1897803b8f1fd52.zip |
[CFL-AA] CFL-AA should not assert on an va_arg instruction
The CFL-AA implementation was missing a visit* routine for va_arg instructions,
causing it to assert when run on a function that had one. For now, handle these
in a conservative way.
Fixes PR20954.
llvm-svn: 219718
Diffstat (limited to 'llvm/lib/Analysis/CFLAliasAnalysis.cpp')
-rw-r--r-- | llvm/lib/Analysis/CFLAliasAnalysis.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/CFLAliasAnalysis.cpp b/llvm/lib/Analysis/CFLAliasAnalysis.cpp index 0386afeb23a..20bd286eea3 100644 --- a/llvm/lib/Analysis/CFLAliasAnalysis.cpp +++ b/llvm/lib/Analysis/CFLAliasAnalysis.cpp @@ -317,6 +317,17 @@ public: Output.push_back(Edge(Ptr, Val, EdgeType::Dereference, AttrNone)); } + void visitVAArgInst(VAArgInst &Inst) { + // We can't fully model va_arg here. For *Ptr = Inst.getOperand(0), it does + // two things: + // 1. Loads a value from *((T*)*Ptr). + // 2. Increments (stores to) *Ptr by some target-specific amount. + // For now, we'll handle this like a landingpad instruction (by placing the + // result in its own group, and having that group alias externals). + auto *Val = &Inst; + Output.push_back(Edge(Val, Val, EdgeType::Assign, AttrAll)); + } + static bool isFunctionExternal(Function *Fn) { return Fn->isDeclaration() || !Fn->hasLocalLinkage(); } |