opt -O3 causes Assertion `New->getType() == getType() && "replaceAllUses of value with new value of different type!"' failed

I am hitting an LLVM assertion from the llc tool iff the bitcode file
is optimized at -O3 level by opt). -O1 and -O2 levels of opt do not
cause this assert.

LLVM version 3.4svn
  DEBUG build with assertions.
  Built Jul 14 2013 (15:39:08).
  Default target: x86_64-unknown-linux-gnu
  Host CPU: amdfam10

I have attached the input bc file before -O3 optimization :bzip2.del.bc.tgz
I have attached the input bc file after -O3 optimization : bzip2.del.opt.bc.tgz

Command to run on -O3 optimized file: llc -cppgen=program bzip2.del.opt.bc

Call stack:

llc: Value.cpp:307: void
llvm::Value::replaceAllUsesWith(llvm::Value*): Assertion
`New->getType() == getType() && "replaceAllUses of value with new
value of different type!"' failed.
0 llc 0x00000000014c716a llvm::sys::PrintStackTrace(_IO_FILE*) + 38
1 llc 0x00000000014c73d1
2 llc 0x00000000014c7718
3 libpthread.so.0 0x000000333060eb10
4 libc.so.6 0x000000332fa30265 gsignal + 53
5 libc.so.6 0x000000332fa31d10 abort + 272
6 libc.so.6 0x000000332fa296e6 __assert_fail + 246
7 llc 0x00000000014702df
llvm::Value::replaceAllUsesWith(llvm::Value*) + 173
8 llc 0x00000000006b91e3
llvm::BitcodeReaderValueList::ResolveConstantForwardRefs() + 1127
9 llc 0x00000000006b9d97
llvm::BitcodeReader::ParseConstants() + 339
10 llc 0x00000000006bc634
llvm::BitcodeReader::ParseFunctionBody(llvm::Function*) + 594
11 llc 0x00000000006c2d63
llvm::BitcodeReader::Materialize(llvm::GlobalValue*, std::string*) +
411
12 llc 0x00000000006c290d
llvm::BitcodeReader::MaterializeModule(llvm::Module*, std::string*) +
195
13 llc 0x000000000144898e
llvm::Module::MaterializeAll(std::string*) + 78
14 llc 0x00000000014489b7
llvm::Module::MaterializeAllPermanently(std::string*) + 29
15 llc 0x00000000006c367b
llvm::ParseBitcodeFile(llvm::MemoryBuffer*, llvm::LLVMContext&,
std::string*) + 93
16 llc 0x0000000000679302
llvm::ParseIR(llvm::MemoryBuffer*, llvm::SMDiagnostic&,
llvm::LLVMContext&) + 214
17 llc 0x000000000067958a llvm::ParseIRFile(std::string
const&, llvm::SMDiagnostic&, llvm::LLVMContext&) + 374
18 llc 0x00000000006680f4
19 llc 0x0000000000668fed main + 199
20 libc.so.6 0x000000332fa1d994 __libc_start_main + 244
21 llc 0x0000000000666319
Stack dump:
0. Program arguments: llc -cppgen=program bzip2.del.opt.bc

bzip2.del.bc.tgz (126 KB)

bzip2.del.opt.bc.tgz (130 KB)

Milind,

Have you filed a bug on this? If not, can you please open a bug report (http://llvm.org/bugs)?

-Hal

Hi Hal,

I have filed http://llvm.org/bugs/show_bug.cgi?id=16780

-Milind

Hi,

I don't see the LLVM bug I filed
(http://llvm.org/bugs/show_bug.cgi?id=16780) making any progress.
Can someone suggest me whether the bug is in the correct state?

-Milind

Hi,

I don't see the LLVM bug I filed
(http://llvm.org/bugs/show_bug.cgi?id=16780) making any progress.
Can someone suggest me whether the bug is in the correct state?

The bug report displays alright for me.

Thanks again,
Hal