[LLVMdev] FunctionPass question
Redmond, Paul
paul.redmond at intel.com
Thu Jan 24 12:47:37 PST 2013
Hi,
I am working on a pass to convert lib calls to intrinsic calls as discussed here: http://lists.cs.uiuc.edu/pipermail/llvmdev/2013-January/058507.html
In my first attempt I created a FunctionPass that uses CallInst::setCalledFunction to replace the callee with the appropriate intrinsic (using Intrinsic::getDeclaration).
After the pass runs I get an assertion from CallGraphSCCPass:
clang-3.3: /home/predmond/src/ssg_llvm/llvm/lib/Analysis/IPA/CallGraphSCCPass.cpp:338: bool {anonymous}::CGPassManager::RefreshCallGraph(llvm::CallGraphSCC&, llvm::CallGraph&, bool): Assertion `CallSites.empty() && "Dangling pointers found in call sites map"' failed.
My guess is that I'm modifying the module illegally in a FunctionPass and things break. I see a similar approach used in InstCombineCall however the difference is setCalledFunction is used to replace one intrinsic with another.
The obvious fix (which works) is to use a ModulePass but I'm wondering if there's a way to make this work with a FunctionPass.
paul
More information about the llvm-dev
mailing list