My question is simple. Given an instruction of type branch, how do I extract the label out of it? For example:
br label %while.cond
Should give me while.cond
br label %while.end
Should give me while.end
br i1 %cmp1, label %if.then, label %if.end
Should give me if, if.then, if.end respectively.
First check
inst->isConditional(), then accessinst->getOperand(1)andinst->getOperand(2)in case it is true andinst->getOperand(0)if it is false.The whole BasicBlock is what
BranchInstactually accepts. If you want%if.thenline, then callgetName()on it.