<div dir="ltr"><div>Hi!</div><div><br></div><div>I found the terminator condition for binary operators a bit unintuitive in the CFG. I was wondering if I am missing something or it is a possible improvement.</div><div><br></div><div>Let's consider the following simple code snippet:</div><div><br></div><div><span style="font-family:monospace,monospace"><font size="2">void g(bool a, bool b) {<br>    if (a || b) {<br>        body();<br>    } else {<br>        body2();<br>    }<br>}</font></span></div><div><br></div><div>We get the following CFG:</div><div><br></div><div><span style="font-family:monospace,monospace"><font size="2"> [B1]<br>   1: body2<br>   2: [B1.1] (ImplicitCastExpr, FunctionToPointerDecay, void (*)(void))<br>   3: [B1.2]()<br>   Preds (1): B3<br>   Succs (1): B0<br><br> [B2]<br>   1: body<br>   2: [B2.1] (ImplicitCastExpr, FunctionToPointerDecay, void (*)(void))<br>   3: [B2.2]()<br>   Preds (2): B3 B4<br>   Succs (1): B0<br><br> [B3]<br>   1: b<br>   2: [B3.1] (ImplicitCastExpr, LValueToRValue, _Bool)<br>   T: if [B4.2] || [B3.2]<br>   Preds (1): B4<br>   Succs (2): B2 B1<br><br> [B4]<br>   1: a<br>   2: [B4.1] (ImplicitCastExpr, LValueToRValue, _Bool)<br>   T: [B4.2] || ...<br>   Preds (1): B5<br>   Succs (2): B2 B3</font></span><br></div><div><br></div><div>The terminator condition for <span style="font-family:monospace,monospace">[B4]</span> is (a cast above) <span style="font-family:monospace,monospace">a</span>. This is pretty intuitive. This value will determine which branch do we take when we leave the basic block.</div><div><br></div><div>The terminator condition for <span style="font-family:monospace,monospace">[B3]</span>, however, is the whole binary or expression. I would expect it to be the right hand side of the logical or. What do you think? What is the reason that we have the whole expression here?</div><div><br></div><div>Regards,</div><div>Gabor<br></div><div><br></div></div>