<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - opt -O3 causes Assertion `New->getType() == getType() && "replaceAllUses of value with new value of different type!"' failed"
   href="http://llvm.org/bugs/show_bug.cgi?id=16780">16780</a>
          </td>
        </tr>

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

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>milind.chabbi@rice.edu
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=10976" name="attach_10976" title="input files">attachment 10976</a> <a href="attachment.cgi?id=10976&action=edit" title="input files">[details]</a></span>
input files

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
I have attached the input bc file after -O3 optimization : bzip2.del.opt.bc


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</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>