[LLVMdev] Error "Cannot emit physreg copy instruction"

edA-qa mort-ora-y eda-qa at disemia.com
Sat Nov 9 03:47:05 PST 2013


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
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Sign: Please digitally sign your emails.
Encrypt: I'm also happy to receive encrypted mail.
-------------- next part --------------
; ModuleID = 'test'

%0 = type { i64, void (i8*)*, i1 (i8*)*, i8*, i8* }
%junk__range_iter = type { i1 (i8*)* }

@junk__construct_range_iter = global void (i8*)* undef
@junk__get_args = internal global i8* ()* undef

declare i64 @leaf_exception_personality(i64, i32, i64, i8*, i8*)

declare i8* @count_malloc(i64)

declare void @_void_destructor(i8*)

declare void @leaf_rethrow(i8*)

; Function Attrs: uwtable
define internal void @_release_Au32a(i8**) #0 {
entry:
  ret void
}

; Function Attrs: uwtable
define internal void @_release_C0PpRbrc(%0**) #0 {
entry:
  ret void
}

; Function Attrs: uwtable
define internal i8* @junk___init_module_get_args_3() #0 {
entry:
  %_return_path = alloca i8
  store i8 0, i8* %_return_path
  %_exception = alloca { i8*, i64 }
  %_return_val = alloca i8*
  %junk__a = alloca %junk__range_iter
  %cond_result = alloca i1
  %0 = call i8* @count_malloc(i64 16)
  %1 = bitcast i8* %0 to i64*
  store i64 0, i64* %1
  store i8* %0, i8** %_return_val
  br label %defer_error_body_3

func_ret_0:                                       ; preds = %loop_end_6
  %2 = load i8** %_return_val
  ret i8* %2

defer_error_end_1:                                ; preds = %defer_error_block_2
  br label %rethrow_19

defer_error_block_2:                              ; preds = %defer_cont_10, %defer_error_land_4
  %return_path_3 = load i8* %_return_path
  store i8 0, i8* %_return_path
  call void @_release_Au32a(i8** %_return_val)
  store i8 %return_path_3, i8* %_return_path
  br label %defer_error_end_1

defer_error_body_3:                               ; preds = %entry
  %3 = load void (i8*)** @junk__construct_range_iter
  %4 = bitcast %junk__range_iter* %junk__a to i8*
  invoke void %3(i8* %4)
          to label %post_call_5 unwind label %defer_error_land_4

defer_error_land_4:                               ; preds = %defer_block_11, %loop_cond_7, %defer_error_body_3
  %5 = landingpad { i8*, i64 } personality i64 (i64, i32, i64, i8*, i8*)* @leaf_exception_personality
          cleanup
  store { i8*, i64 } %5, { i8*, i64 }* %_exception
  store i8 4, i8* %_return_path
  br label %defer_error_block_2

post_call_5:                                      ; preds = %defer_error_body_3
  br label %loop_cond_7

loop_end_6:                                       ; preds = %defer_end_9
  br label %func_ret_0

loop_cond_7:                                      ; preds = %loop_body_16, %post_call_5
  %6 = load %junk__range_iter* %junk__a
  %7 = extractvalue %junk__range_iter %6, 0
  %8 = invoke i8* @count_malloc(i64 40)
          to label %post_call_8 unwind label %defer_error_land_4

post_call_8:                                      ; preds = %loop_cond_7
  %9 = bitcast i8* %8 to %0*
  %ref_count_4 = getelementptr inbounds %0* %9, i32 0, i32 0
  store i64 1, i64* %ref_count_4
  %func_ptr_5 = getelementptr inbounds %0* %9, i32 0, i32 2
  store i1 (i8*)* %7, i1 (i8*)** %func_ptr_5
  %10 = bitcast %junk__range_iter* %junk__a to i8*
  %ctx_data_6 = getelementptr inbounds %0* %9, i32 0, i32 3
  store i8* %10, i8** %ctx_data_6
  %dtor_7 = getelementptr inbounds %0* %9, i32 0, i32 1
  store void (i8*)* @_void_destructor, void (i8*)** %dtor_7
  %11 = alloca %0*
  store %0* %9, %0** %11
  br label %defer_body_12

defer_end_9:                                      ; preds = %defer_cont_10, %defer_cont_10
  %12 = load i1* %cond_result
  br i1 %12, label %loop_body_16, label %loop_end_6

defer_cont_10:                                    ; preds = %post_call_14
  %return_path_14 = load i8* %_return_path
  switch i8 %return_path_14, label %defer_end_9 [
    i8 0, label %defer_end_9
    i8 4, label %defer_error_block_2
  ]

defer_block_11:                                   ; preds = %post_call_15, %defer_land_13
  %return_path_8 = load i8* %_return_path
  store i8 0, i8* %_return_path
  invoke void @_release_C0PpRbrc(%0** %11)
          to label %post_call_14 unwind label %defer_error_land_4

defer_body_12:                                    ; preds = %post_call_8
  %13 = getelementptr inbounds %0* %9, i32 0, i32 3
  %ctx_gptr_9 = load i8** %13
  %14 = getelementptr inbounds %0* %9, i32 0, i32 2
  %func_ptr_11 = load i1 (i8*)** %14
  %15 = invoke i1 %func_ptr_11(i8* %ctx_gptr_9)
          to label %post_call_15 unwind label %defer_land_13

defer_land_13:                                    ; preds = %defer_body_12
  %16 = landingpad { i8*, i64 } personality i64 (i64, i32, i64, i8*, i8*)* @leaf_exception_personality
          cleanup
  store { i8*, i64 } %16, { i8*, i64 }* %_exception
  store i8 4, i8* %_return_path
  br label %defer_block_11

post_call_14:                                     ; preds = %defer_block_11
  store i8 %return_path_8, i8* %_return_path
  br label %defer_cont_10

post_call_15:                                     ; preds = %defer_body_12
  store i1 %15, i1* %cond_result
  br label %defer_block_11

loop_body_16:                                     ; preds = %defer_end_9
  br label %loop_cond_7

loop_next_17:                                     ; No predecessors!
  unreachable

loop_break_18:                                    ; No predecessors!
  unreachable

rethrow_19:                                       ; preds = %defer_error_end_1
  %lpad_result_12 = load { i8*, i64 }* %_exception
  %except_13 = extractvalue { i8*, i64 } %lpad_result_12, 0
  call void @leaf_rethrow(i8* %except_13)
  unreachable
}


More information about the llvm-dev mailing list