<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - UNREACHABLE: Cannot emit physreg copy instruction after r313054"
   href="https://bugs.llvm.org/show_bug.cgi?id=34589">34589</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>UNREACHABLE: Cannot emit physreg copy instruction after r313054
          </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>douglas_yung@playstation.sony.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>After upstream change r313054, one of our private tests has started to hit an
UNREACHABLE errr "Cannot emit physreg copy instruction" in the compiler and
causes the compiler to crash.

The crash occurs when using llc to try and compile the following function:

; test.ll
define i64 @foo(i64 %a) {
entry:
  %shr = lshr i64 %a, 2
  %and = and i64 %shr, 8589934591
  ret i64 %and
}

Run the test through llc with the following command line:

llc < test.ll -mtriple=x86_64-unknown-unknown -mattr=+bmi

On my linux system, this command crashes with the following output:

Cannot emit physreg copy instruction
UNREACHABLE executed at
/home/dyung/src/upstream/llvm_clean/lib/Target/X86/X86InstrInfo.cpp:6707!
#0 0x0000000001da142a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/dyung/src/upstream/313054-linux/bin/llc+0x1da142a)
#1 0x0000000001d9f42e llvm::sys::RunSignalHandlers()
(/home/dyung/src/upstream/313054-linux/bin/llc+0x1d9f42e)
#2 0x0000000001d9f592 SignalHandler(int)
(/home/dyung/src/upstream/313054-linux/bin/llc+0x1d9f592)
#3 0x00007fb09ae4c330 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
#4 0x00007fb099e4cc37 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x36c37)
#5 0x00007fb099e50028 abort (/lib/x86_64-linux-gnu/libc.so.6+0x3a028)
#6 0x0000000001d475ea (/home/dyung/src/upstream/313054-linux/bin/llc+0x1d475ea)
#7 0x00000000011ccd38 llvm::X86InstrInfo::copyPhysReg(llvm::MachineBasicBlock&,
llvm::MachineInstrBundleIterator<llvm::MachineInstr, false>, llvm::DebugLoc
const&, unsigned int,
unsigned int, bool) const
(/home/dyung/src/upstream/313054-linux/bin/llc+0x11ccd38)
#8 0x00000000014ac41e (anonymous
namespace)::ExpandPostRA::runOnMachineFunction(llvm::MachineFunction&)
(/home/dyung/src/upstream/313054-linux/bin/llc+0x14ac41e)
#9 0x0000000001577d45 llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
(/home/dyung/src/upstream/313054-linux/bin/llc+0x1577d45)
#10 0x000000000187a593 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/home/dyung/src/upstream/313054-linux/bin/llc+0x187a593)
#11 0x000000000187a65c llvm::FPPassManager::runOnModule(llvm::Module&)
(/home/dyung/src/upstream/313054-linux/bin/llc+0x187a65c)
#12 0x000000000187a12a llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/dyung/src/upstream/313054-linux/bin/llc+0x187a12a)
#13 0x00000000007327c8 compileModule(char**, llvm::LLVMContext&) [clone
.constprop.363]
(/home/dyung/src/upstream/313054-linux/bin/llc+0x7327c8)
#14 0x00000000006ba344 main
(/home/dyung/src/upstream/313054-linux/bin/llc+0x6ba344)
#15 0x00007fb099e37f45 __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x21f45)
#16 0x000000000072574a _start
(/home/dyung/src/upstream/313054-linux/bin/llc+0x72574a)
Stack dump:
0.    Program arguments: /home/dyung/src/upstream/313054-linux/bin/llc
-mtriple=x86_64-unknown-unknown -mattr=+bmi 
1.    Running pass 'Function Pass Manager' on module '<stdin>'.
2.    Running pass 'Post-RA pseudo instruction expansion pass' on function
'@foo'</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>