<html>
    <head>
      <base href="https://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 --- - branch folder crashes" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D24299&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=ho6lcNVvoDYUPl7CsO_2kJrn1M8wtoKam5ffsJIBxXs&s=eJq1Uu5pifi6TKuPDBvUQezF_nqwHpBIMhO5mVGX__Q&e=">24299</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>branch folder crashes
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </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>Backend: PTX
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>tobias@grosser.es
          </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=14661" name="attach_14661" title="Test case to reproduce the bug">attachment 14661</a> <a href="attachment.cgi?id=14661&action=edit" title="Test case to reproduce the bug">[details]</a></span>
Test case to reproduce the bug

If I run the attached test case through llc (r243247), I get the following
crash:

llc: include/llvm/MC/MCRegisterInfo.h:325: const llvm::MCRegisterDesc
&llvm::MCRegisterInfo::operator[](unsigned int) const: Assertion `RegNo <
NumRegs && "Attempting to access record for invalid register number!"' failed.
#0 0x15fc18e llvm::sys::PrintStackTrace(llvm::raw_ostream&)
lib/Support/Unix/Signals.inc:404:15
#1 0x15fd109 PrintStackTraceSignalHandler(void*)
lib/Support/Unix/Signals.inc:463:1
#2 0x15fbce3 llvm::sys::RunSignalHandlers() lib/Support/Signals.cpp:35:5        
#3 0x15fd55e SignalHandler(int) lib/Support/Unix/Signals.inc:211:1              
#4 0x7f5f54620c90 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0xfc90)   
#5 0x7f5f5383ee37 gsignal
/build/buildd/glibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#6 0x7f5f53840528 abort /build/buildd/glibc-2.19/stdlib/abort.c:91:0            
#7 0x7f5f53837ce6 __assert_fail_base
/build/buildd/glibc-2.19/assert/assert.c:92:0
#8 0x7f5f53837d92 (/lib/x86_64-linux-gnu/libc.so.6+0x2fd92)                     
#9 0x6e00a7 llvm::MCRegisterInfo::operator[](unsigned int) const
include/llvm/MC/MCRegisterInfo.h:326:5
#10 0x6e004b llvm::MCRegisterInfo::get(unsigned int) const
include/llvm/MC/MCRegisterInfo.h:332:5
#11 0x6dea59 llvm::MCSubRegIterator::MCSubRegIterator(unsigned int,
llvm::MCRegisterInfo const*, bool) include/llvm/MC/MCRegisterInfo.h:458:15
#12 0xea37fe llvm::BranchFolder::OptimizeImpDefsBlock(llvm::MachineBasicBlock*)
lib/CodeGen/BranchFolding.cpp:154:27
#13 0xea3d0e llvm::BranchFolder::OptimizeFunction(llvm::MachineFunction&,
llvm::TargetInstrInfo const*, llvm::TargetRegisterInfo const*,
llvm::MachineModuleInfo*) lib/CodeGen/BranchFolding.cpp:219:19
#14 0xeab7f1 (anonymous
namespace)::BranchFolderPass::runOnMachineFunction(llvm::MachineFunction&)
lib/CodeGen/BranchFolding.cpp:103:10
#15 0xcc2dee llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
lib/CodeGen/MachineFunctionPass.cpp:40:3
#16 0x112932d llvm::FPPassManager::runOnFunction(llvm::Function&)
lib/IR/LegacyPassManager.cpp:1520:23
#17 0x1129645 llvm::FPPassManager::runOnModule(llvm::Module&)
lib/IR/LegacyPassManager.cpp:1540:16
#18 0x1129d30 (anonymous namespace)::MPPassManager::runOnModule(llvm::Module&)
lib/IR/LegacyPassManager.cpp:1596:23
#19 0x1129906 llvm::legacy::PassManagerImpl::run(llvm::Module&)
lib/IR/LegacyPassManager.cpp:1698:16
#20 0x112a1e1 llvm::legacy::PassManager::run(llvm::Module&)
lib/IR/LegacyPassManager.cpp:1729:3
#21 0x6a82bc compileModule(char**, llvm::LLVMContext&) tools/llc/llc.cpp:382:3  
#22 0x6a7086 main tools/llc/llc.cpp:204:13                                      
#23 0x7f5f53829ec5 __libc_start_main
/build/buildd/glibc-2.19/csu/libc-start.c:321:0
#24 0x6a6da4 _start (buildbin/llc+0x6a6da4)                                     
Stack dump:                                                                     
0.      Program arguments: buildbin/llc /tmp/branch-folder-bug.ll               
1.      Running pass 'Function Pass Manager' on module
'/tmp/branch-folder-bug.ll'.
2.      Running pass 'Control Flow Optimizer' on function '@hoge'               
~</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>