[LLVMdev] CodeGen fails for CallInst with label

Edward Lee eslee3 at uiuc.edu
Sat Apr 19 01:30:11 PDT 2008


It seems like LLVM happily creates function calls that pass in labels
but doesn't know how to emit them.

For the source c code:
__asm__ __volatile__ ( ".byte 0x0f, 0x36, 0x00" : : "a" (&&label) : "memory" );

llvm-g++ -emit-llvm generates:
tail call void asm sideeffect ".byte 0x0f, 0x36, 0x00",
"{ax},~{dirflag},~{fpsr},~{flags},~{memory}"( label %label ) nounwind

However, trying to assemble x86 binaries fails:
cc1plus: /mounts/zion/disks/0/localhome/tbrethou/2.2/testing/llvm-2.2/include/llvm/CodeGen/ValueTypes.h:212:
unsigned int llvm::MVT::getSizeInBits(llvm::MVT::ValueType): Assertion
`isExtendedVT(VT) && "ValueType has no known size!"' failed.
At global scope: internal compiler error: Aborted

This also happens if I craft my own function to take a label and llvm-as:
declare void @foo(label)
call void @bar( label %label )

llvm-as[0x826fa54]
llvm-as[0x826fd1a]
[0x8cd420]
llvm-as(llvm::PATypeHolder::operator llvm::Type*() const+0x11)[0x816e93b]
llvm-as(llvm::Value::getType() const+0x14)[0x816e952]
llvm-as(llvmAsmparse()+0xccc4)[0x818a14e]
llvm-as[0x818c15c]
llvm-as(llvm::RunVMAsmParser(std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&,
_IO_FILE*)+0x4a)[0x818c5aa]
llvm-as(llvm::ParseAssemblyFile(std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&,
llvm::ParseError*)+0xf3)[0x8178d65]
llvm-as(main+0x84)[0x815aeb6]
/lib/libc.so.6(__libc_start_main+0xdc)[0x6e8dec]
llvm-as(__gxx_personality_v0+0x2a9)[0x815aa81]

llvm-as:  llvm version 2.0 DEBUG build with assertions.
llvm-g++: gcc version 4.2.1 (Based on Apple Inc. build 5546) (LLVM build 2.2)

Ed



More information about the llvm-dev mailing list