[LLVMdev] LLVM tries to remove labels used in blockaddress()

Sebastian Schlunke schlunki at cs.tu-berlin.de
Mon Mar 15 07:11:45 PDT 2010


Hi,

i ran into a problem when using blockaddress() with a label in another function. It seems to me that LLVM tries to remove the label used in blockaddress because it seems like it is not used, but in fact it may be used somewhere with a indirectbr.

I attached a small test-case that produces this error. (The original problem is much more complicated, so i hope the reduced example, which has no indirectbr but produces an error nevertheless, will suffice.)

I compile the code with:
# llvm-as -o main.bc main.ll
# llc -o main.s main.bc

and get:
# While deleting: label %test_label
# An asserting value handle still pointed to this value!
# UNREACHABLE executed at Value.cpp:522!
# 0  llc             0x0000000000c67cdf
# 1  llc             0x0000000000c684fd
# 2  libpthread.so.0 0x00002b24f70db0f0
# 3  libc.so.6       0x00002b24f7ed2435 gsignal + 53
# 4  libc.so.6       0x00002b24f7ed3c40 abort + 384
# 5  llc             0x0000000000c488f4 llvm::llvm_unreachable_internal(char const*, char const*, unsigned int) + 356
# 6  llc             0x0000000000c0eb49 llvm::ValueHandleBase::ValueIsDeleted(llvm::Value*) + 1721
# 7  llc             0x0000000000c0f9cd llvm::Value::~Value() + 749
# 8  llc             0x0000000000b870a5 llvm::BasicBlock::~BasicBlock() + 421
# 9  llc             0x0000000000a2eaaf
# 10 llc             0x0000000000bfb0a6 llvm::FPPassManager::runOnFunction(llvm::Function&) + 534
# 11 llc             0x0000000000bfb281 llvm::FunctionPassManagerImpl::run(llvm::Function&) + 129
# 12 llc             0x0000000000bfb4ae llvm::FunctionPassManager::run(llvm::Function&) + 110
# 13 llc             0x000000000052cf24 main + 3556
# 14 libc.so.6       0x00002b24f7ebda3d __libc_start_main + 253
# 15 llc             0x000000000052ac29
# Stack dump:
# 0.      Program arguments: llc -o main.s -f main.bc 
# 1.      Running pass 'Remove unreachable blocks from the CFG' on function '@test_fun'

I'm using the current svn version (revision 98542). An earlier revision simply generated asm-code, where the appropriate label was missing, thus causing gcc to fail when i wanted to compile the asm-file.

Regards,
Sebastian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.ll
Type: text/assembler-file
Size: 277 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100315/7b6d10ac/attachment.bin>


More information about the llvm-dev mailing list