[LLVMdev] About writing an alias analysis pass for LLVM 3.1
willdtz at gmail.com
Mon Sep 10 06:08:56 PDT 2012
Does your pass use multiple inheritance? Sounds like your problem is
that you need to define getAdjustedAnalysisPointer, see:
An example implementation (very likely exactly what you want) is in
Hope this helps!
On Sep 9, 2012 9:08 PM, "Pei Wang" <uraj.wp at gmail.com> wrote:
> I am now trying to write an alias analysis pass for LLVM 3.1. The pass is compiled into a .so library. When I loaded it into opt to perform evaluation with command:
> opt -load my-so-lib -aa-eval foo.bc
> the following errors occurred:
> opt: raw_ostream.cpp:261: void llvm::raw_ostream::flush_nonempty(): Assertion `OutBufCur > OutBufStart && "Invalid call to flush_nonempty."' failed.
> As stated in the documentation I found on LLVM official website, an alias analysis pass should subclass both Pass and AliasAnalysis class. I used GDB for some debugging, and found why the error emerged.
> By MyAA note the pass class written by me, and by obj note the instance of MyAA. In the crash scene, When LLVM was trying to call obj.alias, a virtual function of class llvm::AliasAnalysis, it actually called obj.print, a virtual function of llvm::Pass, because of the confusion of two virtual function tables. It seems that LLVM assesses obj via a AliasAnalysis* pointer without performing static_cast. However, I have no idea why this happens. I guess it is because I registered the Pass in a wrong way, but still don't know to fix it.
> Anyone can help me? I am not a C++ or LLVM expert, so I got really stranded.
> Thank you in advance.
> Pei Wang
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
More information about the llvm-dev