'opt' Aborted "While deleting: void %"

Hey everyone,

So I have an LLVM pass that appears to run completely and work fine, and
then it aborts at the very end. When exiting the final runOnFunction call,
I get the following error / stack dump. I cannot figure out why this is
happening for the life of me - does anyone have any ideas? I'm not trying
to do any crazy deallocation or anything, it just seems like a normal pass
to me.

Thanks,
Griffin Wright

While deleting: void %
An asserting value handle still pointed to this value!
UNREACHABLE executed at /x/grwright/llvm/llvm-2.9/lib/VMCore/Value.cpp:569!
0 libLLVM-2.9.so 0xf6ef856b
1 libLLVM-2.9.so 0xf6ef82f8
2 0xf7782400 __kernel_sigreturn + 0
3 libc.so.6 0xf57d4d52 abort + 386
4 libLLVM-2.9.so 0xf6ee40d4 llvm::SmallVector<char, 64u>::~SmallVector() +
0
5 libLLVM-2.9.so 0xf6a5ce2e
llvm::ValueHandleBase::ValueIsDeleted(llvm::Value*) + 662
6 libLLVM-2.9.so 0xf6a5b1ec llvm::Value::~Value() + 58
7 libLLVM-2.9.so 0xf66ee041 llvm::User::~User() + 93
8 libLLVM-2.9.so 0xf6a00d89 llvm::Instruction::~Instruction() + 121
9 libLLVM-2.9.so 0xf6a0351f llvm::CallInst::~CallInst() + 57
10 libLLVM-2.9.so 0xf68d9671
llvm::ilist_node_traits<llvm::Instruction>::deleteNode(llvm::Instruction*)
+ 30
11 libLLVM-2.9.so 0xf68d8c80 llvm::iplist<llvm::Instruction,
llvm::ilist_traits<llvm::Instruction>

::erase(llvm::ilist_iterator<llvm::Instruction>) + 48

12 libLLVM-2.9.so 0xf696ac37 llvm::iplist<llvm::Instruction,
llvm::ilist_traits<llvm::Instruction>

::erase(llvm::ilist_iterator<llvm::Instruction>,

llvm::ilist_iterator<llvm::Instruction>) + 49
13 libLLVM-2.9.so 0xf696a7a0 llvm::iplist<llvm::Instruction,
llvm::ilist_traits<llvm::Instruction> >::clear() + 102
14 libLLVM-2.9.so 0xf6969420 llvm::BasicBlock::~BasicBlock() + 314
15 libLLVM-2.9.so 0xf696adb2
llvm::ilist_node_traits<llvm::BasicBlock>::deleteNode(llvm::BasicBlock*) +
30
16 libLLVM-2.9.so 0xf696a9a8 llvm::iplist<llvm::BasicBlock,
llvm::ilist_traits<llvm::BasicBlock>

::erase(llvm::ilist_iterator<llvm::BasicBlock>) + 48

17 libLLVM-2.9.so 0xf696958f llvm::BasicBlock::eraseFromParent() + 77
18 libLLVM-2.9.so 0xf69b7b11 llvm::Function::dropAllReferences() + 159
19 libLLVM-2.9.so 0xf6a2dc59 llvm::Module::dropAllReferences() + 81
20 libLLVM-2.9.so 0xf6a2caf2 llvm::Module::~Module() + 50
21 opt 0x08081e36 std::auto_ptr<llvm::Module>::~auto_ptr() + 36
22 opt 0x0807d5a4 main + 5045
23 libc.so.6 0xf57bdbd6 __libc_start_main + 230
24 opt 0x0806de41
Stack dump:
0. Program arguments: opt -debug -load
/x/grwright/llvm/llvm-sfi/RelRecovery/Debug+Asserts/lib/relRecovery.so
-profile-loader -profile-info-file=164.gzip/llvmprof.out -relRecovery
-rr-analysis-only -rr-use-exec-prof=true -rr-bench=164.gzip
164.gzip/164.gzip.link.bc -o 164.gzip/164.gzip.rel.bc
Aborted

Hi Griffin, did your pass create a data structure that holds values somehow,
and forgot to delete it? Also, try running under valgrind in case this is
due to a memory error of some kind.

Ciao, Duncan.

Yes, it does - all function-wide data structures are cleared/initialized at
the beginning of each function. But perhaps I need to delete them after
the last function instance? I'm modifying someone's existing pass, and
this code worked for them at the time, albeit with a slightly older version
of LLVM. Hmm.

-Griffin

Hi Griffin, did your pass create a data structure that holds values
somehow,
and forgot to delete it? Also, try running under valgrind in case this

is

due to a memory error of some kind.

Ciao, Duncan.

So I have an LLVM pass that appears to run completely and work fine, and
then it aborts at the very end. When exiting the final runOnFunction
call,
I get the following error / stack dump. I cannot figure out why this is
happening for the life of me - does anyone have any ideas? I'm not
trying
to do any crazy deallocation or anything, it just seems like a normal
pass
to me.

Thanks,
Griffin Wright

While deleting: void %
An asserting value handle still pointed to this value!
UNREACHABLE executed at
/x/grwright/llvm/llvm-2.9/lib/VMCore/Value.cpp:569!
0 libLLVM-2.9.so 0xf6ef856b
1 libLLVM-2.9.so 0xf6ef82f8
2 0xf7782400 __kernel_sigreturn + 0
3 libc.so.6 0xf57d4d52 abort + 386
4 libLLVM-2.9.so 0xf6ee40d4 llvm::SmallVector<char,

64u>::~SmallVector()

+
0
5 libLLVM-2.9.so 0xf6a5ce2e
llvm::ValueHandleBase::ValueIsDeleted(llvm::Value*) + 662
6 libLLVM-2.9.so 0xf6a5b1ec llvm::Value::~Value() + 58
7 libLLVM-2.9.so 0xf66ee041 llvm::User::~User() + 93
8 libLLVM-2.9.so 0xf6a00d89 llvm::Instruction::~Instruction() + 121
9 libLLVM-2.9.so 0xf6a0351f llvm::CallInst::~CallInst() + 57
10 libLLVM-2.9.so 0xf68d9671

llvm::ilist_node_traits<llvm::Instruction>::deleteNode(llvm::Instruction*)

Using Valgrind hasn't shown me anything terribly unusual. And I'm confused
because its not even trying to delete a real instruction; deleting a void
type with no name? That doesn't make any sense...

Any other hints? I've seen a few posts in the past about this relating to
some internal LLVM bugs...

-Griffin

Hi Griffin, did your pass create a data structure that holds values
somehow,
and forgot to delete it? Also, try running under valgrind in case this

is

due to a memory error of some kind.

Ciao, Duncan.

So I have an LLVM pass that appears to run completely and work fine, and
then it aborts at the very end. When exiting the final runOnFunction
call,
I get the following error / stack dump. I cannot figure out why this is
happening for the life of me - does anyone have any ideas? I'm not
trying
to do any crazy deallocation or anything, it just seems like a normal
pass
to me.

Thanks,
Griffin Wright

While deleting: void %
An asserting value handle still pointed to this value!
UNREACHABLE executed at
/x/grwright/llvm/llvm-2.9/lib/VMCore/Value.cpp:569!
0 libLLVM-2.9.so 0xf6ef856b
1 libLLVM-2.9.so 0xf6ef82f8
2 0xf7782400 __kernel_sigreturn + 0
3 libc.so.6 0xf57d4d52 abort + 386
4 libLLVM-2.9.so 0xf6ee40d4 llvm::SmallVector<char,

64u>::~SmallVector()

+
0
5 libLLVM-2.9.so 0xf6a5ce2e
llvm::ValueHandleBase::ValueIsDeleted(llvm::Value*) + 662
6 libLLVM-2.9.so 0xf6a5b1ec llvm::Value::~Value() + 58
7 libLLVM-2.9.so 0xf66ee041 llvm::User::~User() + 93
8 libLLVM-2.9.so 0xf6a00d89 llvm::Instruction::~Instruction() + 121
9 libLLVM-2.9.so 0xf6a0351f llvm::CallInst::~CallInst() + 57
10 libLLVM-2.9.so 0xf68d9671

llvm::ilist_node_traits<llvm::Instruction>::deleteNode(llvm::Instruction*)

Hi Griffin,

Using Valgrind hasn't shown me anything terribly unusual. And I'm confused
because its not even trying to delete a real instruction; deleting a void
type with no name? That doesn't make any sense...

Any other hints? I've seen a few posts in the past about this relating to
some internal LLVM bugs...

try running in gdb. When you hit the assert, rummage around.

Ciao, Duncan.