[LLVMdev] Labels

Jaap Suter llvm at jaapsuter.com
Sat Jan 12 14:25:43 PST 2008


> Why is this label unexpected?

Because a label starts a new basic block, but a call instruction is not a proper
closing instruction for the previous basic block.

The solution that I use is to insert a "br l6" instruction just after the call
instruction (effectively a no-op, but it closes the basic-block properly).

See the LLVM documentation on terminators for more information on what closes a
basic block:
 
    http://llvm.org/docs/LangRef.html#terminators

Hope that helps,

Jaap Suter - http://jaapsuter.com

> 	%tmp26 = load i32* @yybegin, align 4
> 	%tmp27 = load i32* @yyend, align 4
> 	call void @yyDo(void (i8*, i32)* @yy_7_body, i32 %tmp26, i32 %tmp27)
> l6:
> 	br label %l2
> <snip>
> 
> I get the following error:
> 
> llvm-as: test.ll:578,0: test.ll:578: error: syntax error, unexpected
> LABELSTR, 
> expecting LOAD or STORE while reading token: 'l6:'






More information about the llvm-dev mailing list