[LLVMdev] Error "Cannot emit physreg copy instruction"

Cameron McInally cameron.mcinally at nyu.edu
Sat Nov 9 07:51:05 PST 2013


Hey edA-qa mort-ora-y,

On Sat, Nov 9, 2013 at 6:47 AM, edA-qa mort-ora-y <eda-qa at disemia.com> wrote:
> I'm getting an error that I don't know how to fix. I've isolated the
> input as much as I easily can. I've attached the file that produces the
> problem. Just calling "llc err.ll -o err.s" generates the error.
>
> I'm going to try and isolate even further, but as I'm not sure what I'm
> looking for I don't know if I'll be successful. Does anybody know what
> this error means?
>
> Cannot emit physreg copy instruction
> UNREACHABLE executed at X86InstrInfo.cpp:2899!
> 0  libLLVM-3.3.so  0x00007f9f68ddf642
> llvm::sys::PrintStackTrace(_IO_FILE*) + 34
> 1  libLLVM-3.3.so  0x00007f9f68dde9a9
> 2  libpthread.so.0 0x00007f9f67a07cb0
> 3  libc.so.6       0x00007f9f67156425 gsignal + 53
> 4  libc.so.6       0x00007f9f67159b8b abort + 379
> 5  libLLVM-3.3.so  0x00007f9f68dc1e7c
> 6  libLLVM-3.3.so  0x00007f9f68fd1832
> llvm::X86InstrInfo::copyPhysReg(llvm::MachineBasicBlock&,
> llvm::MachineBasicBlock::bundle_iterator<llvm::MachineInstr,
> llvm::ilist_iterator<llvm::MachineInstr> >, llvm::DebugLoc, unsigned
> int, unsigned int, bool) const + 1762
> 7  libLLVM-3.3.so  0x00007f9f683afab1
> 8  libLLVM-3.3.so  0x00007f9f6864c417
> llvm::FPPassManager::runOnFunction(llvm::Function&) + 487
> 9  libLLVM-3.3.so  0x00007f9f6864c50b
> llvm::FPPassManager::runOnModule(llvm::Module&) + 43
> 10 libLLVM-3.3.so  0x00007f9f6864beff
> llvm::MPPassManager::runOnModule(llvm::Module&) + 559
> 11 libLLVM-3.3.so  0x00007f9f6864c165
> llvm::PassManagerImpl::run(llvm::Module&) + 245
> 12 llc             0x000000000040d217
> 13 llc             0x0000000000409a58 main + 360
> 14 libc.so.6       0x00007f9f6714176d __libc_start_main + 237
> 15 llc             0x0000000000409ae1
> Stack dump:
> 0.  Program arguments: /opt/llvm/install/bin/llc err.ll -o err.s
> 1.  Running pass 'Function Pass Manager' on module 'err.ll'.
> 2.  Running pass 'Post-RA pseudo instruction expansion pass' on function
> '@junk___init_module_get_args_3'
>
> --
> edA-qa mort-ora-y

I agree that this is an especially hard issue to diagnose, as I have
had issues with it in the recent past. At that time, I was not able to
find a good way to trace the COPY pseudo to a particular statement in
the IR. But, I digress...

The UNREACHABLE you are hitting comes from
X86InstrInfo::copyPhysReg(...) in
llvm/lib/Target/X86/X86InstrInfo.cpp. You're expanding a pseudo COPY
instruction, but the x86 target does not know how to produce a reg-reg
move that matches the problematic COPY instruction.

To find the COPY instruction that is the problem, try compiling with
-debug. You should see a statement, "Cannot copy...", which will give
you the details of the failing instruction.

I have also tried the test cases that you supplied, but was not able
to reproduce the error with ToT. What cpu target are you looking at?

-Cameron



More information about the llvm-dev mailing list