Use of blockadress() crashes llc in some cases

Hi!

In some cases the use of blockaddress() crashes llc.

I've attached two test-cases, one that crashes and for reference a slightly modified one (just 2 lines are commented) that works.

I compile the files with
  # llvm-as test_crash.ll -o - | llc -f -o temp.s -

and get

0 llc 0x0000000000c6ab6f
1 llc 0x0000000000c6b38d
2 libpthread.so.0 0x00007feccd2270f0
3 llc 0x00000000009a270f llvm::DenseMap<llvm::AssertingVH<llvm::BasicBlock>, llvm::MMIAddrLabelMap::AddrLabelSymEntry, llvm::DenseMapInfo<llvm::AssertingVH<llvm::BasicBlock> >, llvm::DenseMapInfo<llvm::MMIAddrLabelMap::AddrLabelSymEntry> >::operator(llvm::AssertingVH<llvm::BasicBlock> const&) + 31
4 llc 0x000000000099f5d0 llvm::MMIAddrLabelMap::UpdateForRAUWBlock(llvm::BasicBlock*, llvm::BasicBlock*) + 64
5 llc 0x0000000000c10c9a llvm::ValueHandleBase::ValueIsRAUWd(llvm::Value*, llvm::Value*) + 442
6 llc 0x0000000000c11115 llvm::Value::uncheckedReplaceAllUsesWith(llvm::Value*) + 261
7 llc 0x0000000000ac86da llvm::MergeBasicBlockIntoOnlyPred(llvm::BasicBlock*, llvm::Pass*) + 186
8 llc 0x0000000000a8780f
9 llc 0x0000000000a8830b
10 llc 0x0000000000a89cd6
11 llc 0x0000000000bfdf16 llvm::FPPassManager::runOnFunction(llvm::Function&) + 534
12 llc 0x0000000000bfe0f1 llvm::FunctionPassManagerImpl::run(llvm::Function&) + 129
13 llc 0x0000000000bfe31e llvm::FunctionPassManager::run(llvm::Function&) + 110
14 llc 0x000000000052d334 main + 3556
15 libc.so.6 0x00007feccc311a3d __libc_start_main + 253
16 llc 0x000000000052b039
Stack dump:
0. Program arguments: llc -f -o temp.s -
1. Running pass 'Optimize for code generation' on function '@reduce_graph'
Segmentation fault

I'm using the svn-version, revision 98581.

Regards,
Sebastian

test_working.ll (422 Bytes)

test_crash.ll (420 Bytes)

Hi Sebastian,

It's probably best to just go ahead and file a bug in the LLVM
bugzilla for this.

- Daniel

Hi!

In some cases the use of blockaddress() crashes llc.

I've attached two test-cases, one that crashes and for reference a slightly modified one (just 2 lines are commented) that works.

This works for me with mainline now, I think I fixed a similar bug recently. In general, please file bugs against bugzilla, it is easier to track than in email. Thanks!

-Chris