[cfe-dev] Finding Fallthrough Block in CFG

Bill Wendling via cfe-dev cfe-dev at lists.llvm.org
Fri Nov 29 19:01:55 PST 2019


I'm trying to find the "fallthrough" block in the CFG. The specific
instance is a CFG block that ends in an "asm goto"

 [B3]
   1: int out2;
   T: asm volatile goto ("testl %0, %0; testl %1, %2; jne %l3" : "+S"
(out1), "+D" (out2) : "r" (out1) :  : label_true, loop);
   Preds (1): B4
   Succs (2): B2 B1

In this case, the "loop" target is also the fallthrough block:

int test2(int out1) {
  int out2;


* asm volatile goto("testl %0, %0; testl %1, %2; jne %l3" : "+S"(out1),
"+D"(out2) : "r"(out1) :: label_true, loop);loop:  return out2;*
label_true:
  return -2;
}

>From the CFG output above, it's hard to determine which of those successors
is supposed to be the fallthrough. I could loop through the blocks in the
CFG, but that seems unnecessarily wasteful. Is there a nicer way to
figure this out?

-bw
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20191129/a9719da0/attachment.html>


More information about the cfe-dev mailing list