Syntax of 'br', 'switch' and 'indirectbr'


The 'br' instruction has the syntax:
  br i1 <cond>, label <iftrue>, label <iffalse>
  br label <dest> ;
Unconditional branch

If we know <cond>'s type must be 'i1', <iftrue><iffalse><dest> have to
be of type 'label',
why does the syntax have to specify them? lib/AsmParser/LLParser.cpp
also checks
these restrictions when reading a *.ll.

I have the same questions for the 'label type' of 'switch' and 'indirectbr'.


I'm not the expert, but I guess it's because EVERY type in LLVM is
specified, even when redundant. Probably to avoid the possible case
when it looks redundant but it's not, and we're too late to fix, since
everyone is using the "feature" for their own purposes.

Safety is always redundant, until it really matters...


Reclaim your digital rights, eliminate DRM, learn more at