<div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><div>If without any brace, the br should correspond to doStuff() in your case. However, maybe I don't list my concern and question very clearly, it is my mistake and I apologize for it. </div><div><br></div><div>Let me show you more details:</div><div><br></div><div><div>1.int main()</div><div>2.{</div><div>3. int i;</div><div>4.</div><div>5.  for (i = 0; i < 256; i++) {</div><div>6.  }</div><div>7.}</div></div><div><br></div><div><div>; <label>:6:                                      ; preds = %3</div><div>  <b>br label %7, !dbg !23</b></div><div><br></div><div>; <label>:7:                                      ; preds = %6</div><div>  %8 = load i32, i32* %2, align 4, !dbg !25</div><div>  %9 = add nsw i32 %8, 1, !dbg !25</div><div>  store i32 %9, i32* %2, align 4, !dbg !25</div><div>  br label %3, !dbg !27, !llvm.loop !28</div></div><div><br></div><div><div>!23 = !DILocation(<b>line: 6</b>, column: 1, scope: !24)</div></div><div><br></div><div>You can see that this br instruction corresponds to right brace(i.e. line 6).</div><div><br></div><div>Let us see:</div><div><br></div><div><div>1.int main()</div><div>2.{</div><div>3.  int i;</div><div>4.</div><div>5.  for (i = 0; i < 256; i++)  {</div><div>6.   continue;</div><div>7.    }</div><div>8. }</div></div><div><br></div><div><div>; <label>:6:                                      ; preds = %3</div><div><b>  br label %7, !dbg !23</b></div><div><br></div><div>; <label>:7:                                      ; preds = %6</div><div>  %8 = load i32, i32* %2, align 4, !dbg !25</div><div>  %9 = add nsw i32 %8, 1, !dbg !25</div><div>  store i32 %9, i32* %2, align 4, !dbg !25</div><div>  br label %3, !dbg !27, !llvm.loop !28</div></div><div><br></div><div>!23 = !DILocation(<b>line: 6</b>, column: 1, scope: !24)</div><div><div>You can see that this br instruction corresponds to continue statement (i.e. line 6).</div></div><div><br></div><div>But, the result is: the first case line 6 right brace will not generated(it make sense and just group), but the latter case is line 6 continue and will generate location information for debugger. My question is they are the same but will be treated differently, I do not know how LLVM backend treat these two IR. Maybe I think these two cases are not related with Clang.</div><div><br></div><br><div style="position:relative;zoom:1"></div><div id="divNeteaseMailCard"></div><br>At 2017-06-03 22:45:11, "Marcin Słowik" <slowikmarcin1992@gmail.com> wrote:<br> <blockquote id="isReplyContent" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"><div dir="ltr">If i'm not mistaken, it is not a matter of LLVM IR nor LLVM backend, but rather LLVM frontend i.e. clang in this case.<div>Also, there is a slight semantic difference between those two cases:</div><div>`}` is not a statement. `continue` is.<br></div><div>In the first case, `br` does not correspond to the `}` itself, but rather to a natural BB termination.</div><div>In the latter, `br` explicitly corresponds to the `continue`.</div><div>If you still wonder what is the difference, look at the IR in the third case: without any braces. Where would you expect the debug information to be?</div><div><br></div><div>Cheers,</div><div>Marcin</div></div><div class="gmail_extra"><br><div class="gmail_quote">2017-06-03 15:46 GMT+02:00 Frozen <span dir="ltr"><<a href="mailto:bluechristlove@163.com" target="_blank">bluechristlove@163.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><br><div>Hi <span style="font-family:sans-serif">Marcin:</span></div><div><span style="font-family:sans-serif">    I don't expect stop the right brace } and expect stop at continue keyword statement. My question is continue keyword statement is the same as right brace } statement in the LLVM IR except the !dbg!23 has different line number. I don't know how the LLVM backend distinguish it. </span></div><div><div class="h5"><br><div style="zoom:1"></div><div id="m_7230631862345310974divNeteaseMailCard"></div><br>在 2017-06-03 19:20:46,"Marcin Słowik" <<a href="mailto:me@marandil.pl" target="_blank">me@marandil.pl</a>> 写道:<br> <blockquote id="m_7230631862345310974isReplyContent" style="PADDING-LEFT:1ex;MARGIN:0px 0px 0px 0.8ex;BORDER-LEFT:#ccc 1px solid"><div dir="auto"><div class="gmail_extra" dir="auto"><div class="gmail_quote">On Jun 3, 2017 9:48 AM, "Frozen via llvm-dev" <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br type="attribution"><blockquote class="m_7230631862345310974quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><div><b>Why continue keyword can be emitted but right brace won't be emitted, and debbuger can stop at continue keyword statement but won't stop at right brace statement?</b></div></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Simply because continue keyword is a part of the AST, while '}' is not. </div><div dir="auto"><br></div><div dir="auto">And you don't break on "natural" terminators. Also, would you expect a different behavior between:</div><div dir="auto"><br></div><div dir="auto">for(i=0;i<N;++i)</div><div dir="auto">    doStuff();</div><div dir="auto"><br></div><div dir="auto">And:</div><div dir="auto"><br></div><div dir="auto"><div dir="auto" style="font-family:sans-serif">for(i=0;i<N;++i) {</div><div dir="auto" style="font-family:sans-serif">    doStuff();</div><div dir="auto" style="font-family:sans-serif">} </div><div dir="auto" style="font-family:sans-serif"><br></div><div dir="auto" style="font-family:sans-serif">While they should be identical on AST level? </div><div dir="auto" style="font-family:sans-serif"><br></div><div dir="auto" style="font-family:sans-serif">Cheers, </div><div dir="auto" style="font-family:sans-serif">Marcin </div></div><div class="gmail_extra" dir="auto"></div></div>
</blockquote></div></div></div><br><br><span title="neteasefooter"><p> </p></span></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Marcin Słowik</div></div>
</div>
</blockquote></div><br><br><span title="neteasefooter"><p> </p></span>