llc assertion failure

I am running the following llvm-ld command to produce native code:

llvm-ld -native -o code.exe code.bc -lm

However, I am getting the following assertion failure in llc. The bytecode has been processed with opt, it passes opt bytecode verification. I'm not too familiar with backend code generation. Does anyone have any insight in to what the problem might be or how to go about debugging it?

Regards,
Ryan

llc: /home/lefever/work/llvm-cvs-070325/include/llvm/Support/Casting.h:199: typename llvm::cast_retty<To, From>::ret_type llvm::cast(const Y&) [with X = llvm::ConstantSDNode, Y = llvm::SDOperand]: Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
/home/lefever/work/install/bin/llc((anonymous namespace)::PrintStackTrace()+0x1a)[0x88b77e6]
/home/lefever/work/install/bin/llc((anonymous namespace)::SignalHandler(int)+0x112)[0x88b7aac]
[0xd5c420]
/lib/libc.so.6(abort+0x101)[0x4cab64f1]
/lib/libc.so.6(__assert_fail+0xfd)[0x4caae859]
/home/lefever/work/install/bin/llc(llvm::cast_retty<llvm::ConstantSDNode, llvm::SDOperand>::ret_type llvm::cast<llvm::ConstantSDNode, llvm::SDOperand>(llvm::SDOperand const&)+0x4c)[0x83f6af6]
/home/lefever/work/install/bin/llc(llvm::ScheduleDAG::EmitNode(llvm::SDNode*, llvm::DenseMap<llvm::SDNode*, unsigned int, llvm::DenseMapKeyInfo<llvm::SDNode*> >&)+0x8b2)[0x86ab9fc]
/home/lefever/work/install/bin/llc(llvm::ScheduleDAG::EmitSchedule()+0x283)[0x86abf7d]
/home/lefever/work/install/bin/llc[0x861cada]
/home/lefever/work/install/bin/llc(llvm::ScheduleDAG::Run()+0x94)[0x86a9d6c]
/home/lefever/work/install/bin/llc(llvm::SelectionDAGISel::ScheduleAndEmitDAG(llvm::SelectionDAG&)+0x73)[0x863e64d]
/home/lefever/work/install/bin/llc[0x84edf05]
/home/lefever/work/install/bin/llc(llvm::SelectionDAGISel::CodeGenAndEmitDAG(llvm::SelectionDAG&)+0x13b)[0x863e7ab]
/home/lefever/work/install/bin/llc(llvm::SelectionDAGISel::SelectBasicBlock(llvm::BasicBlock*, llvm::MachineFunction&, llvm::FunctionLoweringInfo&)+0xad)[0x8652ca7]
/home/lefever/work/install/bin/llc(llvm::SelectionDAGISel::runOnFunction(llvm::Function&)+0x5d2)[0x865449e]
/home/lefever/work/install/bin/llc[0x851d559]
/home/lefever/work/install/bin/llc(llvm::FPPassManager::runOnFunction(llvm::Function&)+0x13a)[0x8844a7c]
/home/lefever/work/install/bin/llc(llvm::FunctionPassManagerImpl::run(llvm::Function&)+0x6e)[0x8844d00]
/home/lefever/work/install/bin/llc(llvm::FunctionPassManager::run(llvm::Function&)+0x88)[0x8844dc0]
/home/lefever/work/install/bin/llc(main+0xbe0)[0x83b9cb6]
/lib/libc.so.6(__libc_start_main+0xdc)[0x4caa24e4]
/home/lefever/work/install/bin/llc(__gxx_personality_v0+0x171)[0x83b8031]
llvm-ld:
make: *** [benchmarks/bc-1.06/src/bc---all.rdi_prim.exe] Error 1

Hi Ryan,

I am running the following llvm-ld command to produce native code:

llvm-ld -native -o code.exe code.bc -lm

However, I am getting the following assertion failure in llc. The
bytecode has been processed with opt, it passes opt bytecode
verification. I'm not too familiar with backend code generation. Does
anyone have any insight in to what the problem might be or how to go
about debugging it?

Okay, a couple things:

1. Does the llc version match the llvm-gcc or whatever frontend that
   produced "code.bc". This could simply be an IR version issue if
   you're working on CVS HEAD. If that's not it, then ...

2. This looks to be an llc problem not llvm-ld. All that is happening
   here is that llvm-ld is exec'ing llc on code.bc. Could you please
   run llc under the debugger and give it code.bc as input. When it
   fails, please get a stack trace and then create a PR for this
   problem.

Thanks,

Reid.

Is a PR a bug report on the bugzilla database? I am also running bugpoint to see if that yields anything.

Reid Spencer wrote:

Is a PR a bug report on the bugzilla database?

Yes, so named because of the URL translation. I.e. http://llvm.org/PR123
takes you to bugzilla bug 123. PR == Problem Report.

I am also running
bugpoint to see if that yields anything.

Okay, good. That might turn up something useful. If you suspect its a
bug, please file the stack trace and reduced test case in a new PR.

Thanks, Ryan.

Reid.

Reid,

I have filed the llc assertion failure as a new bug report. I attached the offending bytecode, and the results of running bugpoint.

Thanks,
Ryan

Reid Spencer wrote:

I am running the following llvm-ld command to produce native code:

llvm-ld -native -o code.exe code.bc -lm

However, I am getting the following assertion failure in llc. The

Fixed.

-Chris

bytecode has been processed with opt, it passes opt bytecode
verification. I'm not too familiar with backend code generation. Does
anyone have any insight in to what the problem might be or how to go
about debugging it?

Okay, a couple things:

1. Does the llc version match the llvm-gcc or whatever frontend that
  produced "code.bc". This could simply be an IR version issue if
  you're working on CVS HEAD. If that's not it, then ...

2. This looks to be an llc problem not llvm-ld. All that is happening
  here is that llvm-ld is exec'ing llc on code.bc. Could you please
  run llc under the debugger and give it code.bc as input. When it
  fails, please get a stack trace and then create a PR for this
  problem.

Thanks,

Reid.

Regards,
Ryan

llc:
/home/lefever/work/llvm-cvs-070325/include/llvm/Support/Casting.h:199:
typename llvm::cast_retty<To, From>::ret_type llvm::cast(const Y&) [with
X = llvm::ConstantSDNode, Y = llvm::SDOperand]: Assertion `isa<X>(Val)
&& "cast<Ty>() argument of incompatible type!"' failed.
/home/lefever/work/install/bin/llc((anonymous
namespace)::PrintStackTrace()+0x1a)[0x88b77e6]
/home/lefever/work/install/bin/llc((anonymous
namespace)::SignalHandler(int)+0x112)[0x88b7aac]
[0xd5c420]
/lib/libc.so.6(abort+0x101)[0x4cab64f1]
/lib/libc.so.6(__assert_fail+0xfd)[0x4caae859]
/home/lefever/work/install/bin/llc(llvm::cast_retty<llvm::ConstantSDNode,
llvm::SDOperand>::ret_type llvm::cast<llvm::ConstantSDNode,
llvm::SDOperand>(llvm::SDOperand const&)+0x4c)[0x83f6af6]
/home/lefever/work/install/bin/llc(llvm::ScheduleDAG::EmitNode(llvm::SDNode*,
llvm::DenseMap<llvm::SDNode*, unsigned int,
llvm::DenseMapKeyInfo<llvm::SDNode*> >&)+0x8b2)[0x86ab9fc]
/home/lefever/work/install/bin/llc(llvm::ScheduleDAG::EmitSchedule()+0x283)[0x86abf7d]
/home/lefever/work/install/bin/llc[0x861cada]
/home/lefever/work/install/bin/llc(llvm::ScheduleDAG::Run()+0x94)[0x86a9d6c]
/home/lefever/work/install/bin/llc(llvm::SelectionDAGISel::ScheduleAndEmitDAG(llvm::SelectionDAG&)+0x73)[0x863e64d]
/home/lefever/work/install/bin/llc[0x84edf05]
/home/lefever/work/install/bin/llc(llvm::SelectionDAGISel::CodeGenAndEmitDAG(llvm::SelectionDAG&)+0x13b)[0x863e7ab]
/home/lefever/work/install/bin/llc(llvm::SelectionDAGISel::SelectBasicBlock(llvm::BasicBlock*,
llvm::MachineFunction&, llvm::FunctionLoweringInfo&)+0xad)[0x8652ca7]
/home/lefever/work/install/bin/llc(llvm::SelectionDAGISel::runOnFunction(llvm::Function&)+0x5d2)[0x865449e]
/home/lefever/work/install/bin/llc[0x851d559]
/home/lefever/work/install/bin/llc(llvm::FPPassManager::runOnFunction(llvm::Function&)+0x13a)[0x8844a7c]
/home/lefever/work/install/bin/llc(llvm::FunctionPassManagerImpl::run(llvm::Function&)+0x6e)[0x8844d00]
/home/lefever/work/install/bin/llc(llvm::FunctionPassManager::run(llvm::Function&)+0x88)[0x8844dc0]
/home/lefever/work/install/bin/llc(main+0xbe0)[0x83b9cb6]
/lib/libc.so.6(__libc_start_main+0xdc)[0x4caa24e4]
/home/lefever/work/install/bin/llc(__gxx_personality_v0+0x171)[0x83b8031]
llvm-ld:
make: *** [benchmarks/bc-1.06/src/bc---all.rdi_prim.exe] Error 1
_______________________________________________
LLVM Developers mailing list
LLVMdev@cs.uiuc.edu http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

_______________________________________________
LLVM Developers mailing list
LLVMdev@cs.uiuc.edu http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

-Chris