[LLVMdev] PLEASE help with Alias Analysis initialization assertion at the end of my pass

Griffin Wright grwright at umich.edu
Wed Jan 25 11:20:42 PST 2012


Yes, it is a pass.

Here is a very general overview of the file structure as far as the AA is
concerned. LLVM is not my strong-suit, I do hardware simulators, not
compilers. 

using namespace llvm;

char RelRecovery::ID = 0;
static RegisterPass<RelRecovery> X("relRecovery",
    "Reliability transformation for lightweight recovery");

void RelRecovery::getAnalysisUsage(AnalysisUsage &AU) const { STUFF }

bool RelRecovery::doInitialization(Module &M) { STUFF }

bool RelRecovery::runOnFunction(Function &F) { STUFF }

// Analysis Handles
AliasAnalysis* RelRecovery::AA = 0;

I then call the pass using opt with -relRecovery.

Thanks,
Griffin


On Wed, 25 Jan 2012 11:02:16 -0800, Nick Lewycky <nicholas at mxc.ca> wrote:
> Griffin Wright wrote:
>>
>> Hello all,
>>
>> I really, really, really need your help.  This is my third email now,
>> please don't ignore me!  I understand this must be a trivial thing, but
>> I've ground to a halt, and REALLY need some guidance.  Please see below
>> for
>> the context of my problem.  I'm not trying to be a waste of time, but
I'm
>> desperate here.
>>
>> I have a getAnalysisUsage method which does the following (excerpted):
>> void RelRecovery::getAnalysisUsage(AnalysisUsage&AU) const {
>> AU.addRequired<AliasAnalysis>  (); }
>>
>> and then a runOnFunction method which does this:
>>
>> bool RelRecovery::runOnFunction(Function&F) { AA =
>> &getAnalysis<AliasAnalysis>  (); }
>>
>> This is the same setup as with a bunch of other analyses (LoopInfo,
>> ProfileInfo, etc) and they all work fine. I've read that AA needs a call
>> to
>> InitializeAliasAnalysis(this) in the main run method (in my case,
>> runOnFunction), and I'm wondering how to properly implement it, since
the
>> parameter is supposed to be a Pass.
> 
> Is RelRecovery not a Pass? Does it not derive from ModulePass or 
> FunctionPass? You showed that it has a getAnalysisUsage method and a 
> runOnFunction method which only make sense on passes...
> 
> Nick
> 
>>
>> Thank you!
>>
>> -Griffin
>>
>> On Mon, 23 Jan 2012 14:54:43 -0500, Griffin Wright<grwright at umich.edu>
>> wrote:
>>
>>      Hello all, I am working with someone else's LLVM code, which is
>>      about 8
>> months old. Part of this pass involves AliasAnalysis, and I'm getting
the
>> above assertion when the pass completes. The dump is as follows:
>>
>> --------------------------------
>> Program received signal SIGABRT, Aborted. 0xf7fdf430 in
__kernel_vsyscall
>> () (gdb) bt #0 0xf7fdf430 in __kernel_vsyscall () #1 0xf602e921 in
>> *__GI_raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64 #2
>> 0xf6031d52 in *__GI_abort () at abort.c:92 #3 0xf6027788 in
>> *__GI___assert_fail (assertion=0xf78ef62c "AA&&  \"AA didn't call
>> InitializeAliasAnalysis in its run method!\"", file=0xf78ef5f0
>> "/x/grwright/llvm/llvm-2.9/lib/Analysis/AliasAnalysis.cpp", line=59,
>> function=0xf78f0e40 "virtual void
>> llvm::AliasAnalysis::deleteValue(llvm::Value*)") at assert.c:81 #4
>> 0xf6c37686 in llvm::AliasAnalysis::deleteValue (this=0x81848d0,
>> V=0x8147000) at
>>
>> /x/grwright/llvm/llvm-2.9/lib/Analysis/AliasAnalysis.cpp:59
>>
>>      #5 0xf6c47153 in llvm::AliasSetTracker::deleteValue
(this=0x823ab58,
>> PtrVal=0x8147000) at
>> /x/grwright/llvm/llvm-2.9/lib/Analysis/AliasSetTracker.cpp:505 #6
>> 0xf6c47ae6 in llvm::AliasSetTracker::ASTCallbackVH::deleted
>> (this=0x8233ce8) at
>> /x/grwright/llvm/llvm-2.9/lib/Analysis/AliasSetTracker.cpp:619 #7
>> 0xf72b9d2f in llvm::ValueHandleBase::ValueIsDeleted (V=0x8147000) at
>> /x/grwright/llvm/llvm-2.9/lib/VMCore/Value.cpp:557 #8 0xf72b81ec in
>> ~Value
>> (this=0x8147000, __in_chrg=<value optimized
>>
>> out>)
>>
>>      at /x/grwright/llvm/llvm-2.9/lib/VMCore/Value.cpp:60 #9 0xf6f4b041
>>      in
>> ~User (this=0x8147000, __in_chrg=<value optimized out>) at
>> /x/grwright/llvm/llvm-2.9/include/llvm/User.h:62 #10 0xf725dd89 in
>> ~Instruction (this=0x8147000, __in_chrg=<value
>>
>> optimized
>>
>>      out>) at /x/grwright/llvm/llvm-2.9/lib/VMCore/Instruction.cpp:54
#11
>> 0xf7275461 in ~GetElementPtrInst (this=0x8147000, __in_chrg=<value
>> optimized out>) at
>> /x/grwright/llvm/llvm-2.9/include/llvm/Instructions.h:285 #12 0xf7136671
>> in
>> llvm::ilist_node_traits<llvm::Instruction>::deleteNode (V=0x8147000) at
>> /x/grwright/llvm/llvm-2.9/include/llvm/ADT/ilist.h:112 #13 0xf7135c80 in
>> llvm::iplist<llvm::Instruction, llvm::ilist_traits<llvm::Instruction>
>>> ::erase (this=0x8145d14,
>>
>> where=...)
>>
>>      at /x/grwright/llvm/llvm-2.9/include/llvm/ADT/ilist.h:463 #14
>> 0xf71c7c37 in llvm::iplist<llvm::Instruction,
>> llvm::ilist_traits<llvm::Instruction>  >::erase (this=0x8145d14,
>>
>> first=...,
>>
>>      last=...) at /x/grwright/llvm/llvm-2.9/include/llvm/ADT/ilist.h:528
>>      #15
>> 0xf71c77a0 in llvm::iplist<llvm::Instruction,
>> llvm::ilist_traits<llvm::Instruction>  >::clear (this=0x8145d14) at
>> /x/grwright/llvm/llvm-2.9/include/llvm/ADT/ilist.h:532 #16 0xf71c6420 in
>> ~BasicBlock (this=0x8145cf8, __in_chrg=<value optimized out>) at
>> /x/grwright/llvm/llvm-2.9/lib/VMCore/BasicBlock.cpp:82 #17 0xf71c7db2 in
>> llvm::ilist_node_traits<llvm::BasicBlock>::deleteNode (V=0x8145cf8) at
>> /x/grwright/llvm/llvm-2.9/include/llvm/ADT/ilist.h:112 #18 0xf71c79a8 in
>> llvm::iplist<llvm::BasicBlock, llvm::ilist_traits<llvm::BasicBlock>
>>> ::erase (this=0x80be818, where=...) at
>> /x/grwright/llvm/llvm-2.9/include/llvm/ADT/ilist.h:463 #19 0xf71c658f in
>> llvm::BasicBlock::eraseFromParent (this=0x8145cf8) at
>> /x/grwright/llvm/llvm-2.9/lib/VMCore/BasicBlock.cpp:101 #20 0xf7214b11
in
>> llvm::Function::dropAllReferences (this=0x80be7e8) at
>> /x/grwright/llvm/llvm-2.9/lib/VMCore/Function.cpp:233 #21 0xf728ac59 in
>> llvm::Module::dropAllReferences (this=0x80a9690) at
>> /x/grwright/llvm/llvm-2.9/lib/VMCore/Module.cpp:449 #22 0xf7289af2 in
>> ~Module (this=0x80a9690, __in_chrg=<value optimized
>>
>> out>)
>>
>>      at /x/grwright/llvm/llvm-2.9/lib/VMCore/Module.cpp:70 #23
0x08081e36
>>      in
>> ~auto_ptr (this=0xffffd734, __in_chrg=<value optimized out>) at
>> /usr/include/c++/4.4/backward/auto_ptr.h:168 #24 0x0807d5a4 in main
>> (argc=13, argv=0xffffd814) at
>> /x/grwright/llvm/llvm-2.9/tools/opt/opt.cpp:695
>> --------------------------------
>>
>>
>>
>>
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>

On Wed, 25 Jan 2012 11:02:16 -0800, Nick Lewycky <nicholas at mxc.ca> wrote:
> Griffin Wright wrote:
>>
>> Hello all,
>>
>> I really, really, really need your help.  This is my third email now,
>> please don't ignore me!  I understand this must be a trivial thing, but
>> I've ground to a halt, and REALLY need some guidance.  Please see below
>> for
>> the context of my problem.  I'm not trying to be a waste of time, but
I'm
>> desperate here.
>>
>> I have a getAnalysisUsage method which does the following (excerpted):
>> void RelRecovery::getAnalysisUsage(AnalysisUsage&AU) const {
>> AU.addRequired<AliasAnalysis>  (); }
>>
>> and then a runOnFunction method which does this:
>>
>> bool RelRecovery::runOnFunction(Function&F) { AA =
>> &getAnalysis<AliasAnalysis>  (); }
>>
>> This is the same setup as with a bunch of other analyses (LoopInfo,
>> ProfileInfo, etc) and they all work fine. I've read that AA needs a call
>> to
>> InitializeAliasAnalysis(this) in the main run method (in my case,
>> runOnFunction), and I'm wondering how to properly implement it, since
the
>> parameter is supposed to be a Pass.
> 
> Is RelRecovery not a Pass? Does it not derive from ModulePass or 
> FunctionPass? You showed that it has a getAnalysisUsage method and a 
> runOnFunction method which only make sense on passes...
> 
> Nick
> 
>>
>> Thank you!
>>
>> -Griffin
>>
>> On Mon, 23 Jan 2012 14:54:43 -0500, Griffin Wright<grwright at umich.edu>
>> wrote:
>>
>>      Hello all, I am working with someone else's LLVM code, which is
>>      about 8
>> months old. Part of this pass involves AliasAnalysis, and I'm getting
the
>> above assertion when the pass completes. The dump is as follows:
>>
>> --------------------------------
>> Program received signal SIGABRT, Aborted. 0xf7fdf430 in
__kernel_vsyscall
>> () (gdb) bt #0 0xf7fdf430 in __kernel_vsyscall () #1 0xf602e921 in
>> *__GI_raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64 #2
>> 0xf6031d52 in *__GI_abort () at abort.c:92 #3 0xf6027788 in
>> *__GI___assert_fail (assertion=0xf78ef62c "AA&&  \"AA didn't call
>> InitializeAliasAnalysis in its run method!\"", file=0xf78ef5f0
>> "/x/grwright/llvm/llvm-2.9/lib/Analysis/AliasAnalysis.cpp", line=59,
>> function=0xf78f0e40 "virtual void
>> llvm::AliasAnalysis::deleteValue(llvm::Value*)") at assert.c:81 #4
>> 0xf6c37686 in llvm::AliasAnalysis::deleteValue (this=0x81848d0,
>> V=0x8147000) at
>>
>> /x/grwright/llvm/llvm-2.9/lib/Analysis/AliasAnalysis.cpp:59
>>
>>      #5 0xf6c47153 in llvm::AliasSetTracker::deleteValue
(this=0x823ab58,
>> PtrVal=0x8147000) at
>> /x/grwright/llvm/llvm-2.9/lib/Analysis/AliasSetTracker.cpp:505 #6
>> 0xf6c47ae6 in llvm::AliasSetTracker::ASTCallbackVH::deleted
>> (this=0x8233ce8) at
>> /x/grwright/llvm/llvm-2.9/lib/Analysis/AliasSetTracker.cpp:619 #7
>> 0xf72b9d2f in llvm::ValueHandleBase::ValueIsDeleted (V=0x8147000) at
>> /x/grwright/llvm/llvm-2.9/lib/VMCore/Value.cpp:557 #8 0xf72b81ec in
>> ~Value
>> (this=0x8147000, __in_chrg=<value optimized
>>
>> out>)
>>
>>      at /x/grwright/llvm/llvm-2.9/lib/VMCore/Value.cpp:60 #9 0xf6f4b041
>>      in
>> ~User (this=0x8147000, __in_chrg=<value optimized out>) at
>> /x/grwright/llvm/llvm-2.9/include/llvm/User.h:62 #10 0xf725dd89 in
>> ~Instruction (this=0x8147000, __in_chrg=<value
>>
>> optimized
>>
>>      out>) at /x/grwright/llvm/llvm-2.9/lib/VMCore/Instruction.cpp:54
#11
>> 0xf7275461 in ~GetElementPtrInst (this=0x8147000, __in_chrg=<value
>> optimized out>) at
>> /x/grwright/llvm/llvm-2.9/include/llvm/Instructions.h:285 #12 0xf7136671
>> in
>> llvm::ilist_node_traits<llvm::Instruction>::deleteNode (V=0x8147000) at
>> /x/grwright/llvm/llvm-2.9/include/llvm/ADT/ilist.h:112 #13 0xf7135c80 in
>> llvm::iplist<llvm::Instruction, llvm::ilist_traits<llvm::Instruction>
>>> ::erase (this=0x8145d14,
>>
>> where=...)
>>
>>      at /x/grwright/llvm/llvm-2.9/include/llvm/ADT/ilist.h:463 #14
>> 0xf71c7c37 in llvm::iplist<llvm::Instruction,
>> llvm::ilist_traits<llvm::Instruction>  >::erase (this=0x8145d14,
>>
>> first=...,
>>
>>      last=...) at /x/grwright/llvm/llvm-2.9/include/llvm/ADT/ilist.h:528
>>      #15
>> 0xf71c77a0 in llvm::iplist<llvm::Instruction,
>> llvm::ilist_traits<llvm::Instruction>  >::clear (this=0x8145d14) at
>> /x/grwright/llvm/llvm-2.9/include/llvm/ADT/ilist.h:532 #16 0xf71c6420 in
>> ~BasicBlock (this=0x8145cf8, __in_chrg=<value optimized out>) at
>> /x/grwright/llvm/llvm-2.9/lib/VMCore/BasicBlock.cpp:82 #17 0xf71c7db2 in
>> llvm::ilist_node_traits<llvm::BasicBlock>::deleteNode (V=0x8145cf8) at
>> /x/grwright/llvm/llvm-2.9/include/llvm/ADT/ilist.h:112 #18 0xf71c79a8 in
>> llvm::iplist<llvm::BasicBlock, llvm::ilist_traits<llvm::BasicBlock>
>>> ::erase (this=0x80be818, where=...) at
>> /x/grwright/llvm/llvm-2.9/include/llvm/ADT/ilist.h:463 #19 0xf71c658f in
>> llvm::BasicBlock::eraseFromParent (this=0x8145cf8) at
>> /x/grwright/llvm/llvm-2.9/lib/VMCore/BasicBlock.cpp:101 #20 0xf7214b11
in
>> llvm::Function::dropAllReferences (this=0x80be7e8) at
>> /x/grwright/llvm/llvm-2.9/lib/VMCore/Function.cpp:233 #21 0xf728ac59 in
>> llvm::Module::dropAllReferences (this=0x80a9690) at
>> /x/grwright/llvm/llvm-2.9/lib/VMCore/Module.cpp:449 #22 0xf7289af2 in
>> ~Module (this=0x80a9690, __in_chrg=<value optimized
>>
>> out>)
>>
>>      at /x/grwright/llvm/llvm-2.9/lib/VMCore/Module.cpp:70 #23
0x08081e36
>>      in
>> ~auto_ptr (this=0xffffd734, __in_chrg=<value optimized out>) at
>> /usr/include/c++/4.4/backward/auto_ptr.h:168 #24 0x0807d5a4 in main
>> (argc=13, argv=0xffffd814) at
>> /x/grwright/llvm/llvm-2.9/tools/opt/opt.cpp:695
>> --------------------------------
>>
>>
>>
>>
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>



More information about the llvm-dev mailing list