[LLVMdev] labels commented out

Tim Northover t.p.northover at gmail.com
Fri Nov 1 13:01:24 PDT 2013


Hi Preston,

> Note that labels %2 and %13 are not actually defined, though they're both
> referred to by the first branch and in comments.
>
> What's the deal?

Basic blocks (like instructions) mostly only get textual labels when
Clang has been built with assertions enabled. Without that they
implicitly pick up the next numeric value that hasn't been defined
yet, almost like an instruction. (In your example %2 follows the
definition of %1 and %13 follows the definition of %12).

You can actually do similar tricks with normal instructions:

define i32 @foo(i32 %in) {
  add i32 %in, %in
  ret i32 %1
}

it's just the default for labels for some reason.

Other than that it's just LLVM adding some (hopefully useful to
someone) comments when printing out the function.

Cheers.

Tim.



More information about the llvm-dev mailing list