<div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><p style="margin: 0px 0px 1em; padding: 0px; border: 0px; font-variant-numeric: inherit; font-stretch: inherit; font-size: 15px; line-height: inherit; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; vertical-align: baseline; clear: both; color: rgb(36, 39, 41);">Let me show you the following simple C code:</p><pre style="margin-top: 0px; margin-bottom: 1em; padding: 5px; border: 0px; font-variant-numeric: inherit; font-stretch: inherit; font-size: 13px; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; width: auto; max-height: 600px; overflow: auto; background-color: rgb(239, 240, 241); word-wrap: normal; color: rgb(36, 39, 41);"><code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; white-space: inherit;">int main()
{
  int i;

  for (i = 0; i < 256; i++)
  {
      i++;
  }
}
</code></pre><p style="margin: 0px 0px 1em; padding: 0px; border: 0px; font-variant-numeric: inherit; font-stretch: inherit; font-size: 15px; line-height: inherit; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; vertical-align: baseline; clear: both; color: rgb(36, 39, 41);">In this simple C code, if we use Clang to compile it and debug it: We will get something like this:</p><pre style="margin-top: 0px; margin-bottom: 1em; padding: 5px; border: 0px; font-variant-numeric: inherit; font-stretch: inherit; font-size: 13px; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; width: auto; max-height: 600px; overflow: auto; background-color: rgb(239, 240, 241); word-wrap: normal; color: rgb(36, 39, 41);"><code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; white-space: inherit;">(gdb) b main
Breakpoint 1 at 0x100000f7b: file a.c, line 5.
(gdb) r
Starting program: a.out 
[New Thread 0x1403 of process 23435]
warning: unhandled dyld version (15)

Thread 2 hit Breakpoint 1, main () at a.c:5
5     for (i = 0; i < 256; i++)
(gdb) n
7         i++;
(gdb) 
5     for (i = 0; i < 256; i++)
(gdb) 
7         i++;
</code></pre><p style="margin: 0px 0px 1em; padding: 0px; border: 0px; font-variant-numeric: inherit; font-stretch: inherit; font-size: 15px; line-height: inherit; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; vertical-align: baseline; clear: both; color: rgb(36, 39, 41);">That is to say, the right brace of location LLVM doesn't emit. However if we have the continue keyword:</p><pre style="margin-top: 0px; margin-bottom: 1em; padding: 5px; border: 0px; font-variant-numeric: inherit; font-stretch: inherit; font-size: 13px; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; width: auto; max-height: 600px; overflow: auto; background-color: rgb(239, 240, 241); word-wrap: normal; color: rgb(36, 39, 41);"><code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; white-space: inherit;">int main()
{
  int i;

  for (i = 0; i < 256; i++)
  {
    continue;
    i++;
  }
}
</code></pre><p style="margin: 0px 0px 1em; padding: 0px; border: 0px; font-variant-numeric: inherit; font-stretch: inherit; font-size: 15px; line-height: inherit; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; vertical-align: baseline; clear: both; color: rgb(36, 39, 41);">Then we compile and debug it:</p><pre style="margin-top: 0px; margin-bottom: 1em; padding: 5px; border: 0px; font-variant-numeric: inherit; font-stretch: inherit; font-size: 13px; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; width: auto; max-height: 600px; overflow: auto; background-color: rgb(239, 240, 241); word-wrap: normal; color: rgb(36, 39, 41);"><code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; white-space: inherit;">Thread 2 hit Breakpoint 1, main () at a.c:5
5     for (i = 0; i < 256; i++)
(gdb) n
7       continue;
(gdb) 
5     for (i = 0; i < 256; i++)
(gdb) 
7       continue;
(gdb) 
5     for (i = 0; i < 256; i++)
(gdb) 
7       continue;
</code></pre><p style="margin: 0px 0px 1em; padding: 0px; border: 0px; font-variant-numeric: inherit; font-stretch: inherit; font-size: 15px; line-height: inherit; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; vertical-align: baseline; clear: both; color: rgb(36, 39, 41);">We will stop the line of continue. But if we compare the LLVM IR between them:</p><p style="margin: 0px 0px 1em; padding: 0px; border: 0px; font-variant-numeric: inherit; font-stretch: inherit; font-size: 15px; line-height: inherit; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; vertical-align: baseline; clear: both; color: rgb(36, 39, 41);">The right brace and continue keyword both are the following the br instruction and !dbg !23. Except that the line number of !dbg !23 not the same.</p><p style="margin: 0px 0px 1em; padding: 0px; border: 0px; font-variant-numeric: inherit; font-stretch: inherit; font-size: 15px; line-height: inherit; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; vertical-align: baseline; clear: both; color: rgb(36, 39, 41);">; :6: ; preds = %3 br label %7, !dbg !23</p><p style="margin: 0px 0px 1em; padding: 0px; border: 0px; font-variant-numeric: inherit; font-stretch: inherit; font-size: 15px; line-height: inherit; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; vertical-align: baseline; clear: both; color: rgb(36, 39, 41);">The question is how LLVM know whether to generate the debug location(generate for the continue keyword line, but not for the loop's right brace)? Because they are the same br instruction and others are the same.</p></div><br><br><span title="neteasefooter"><p> </p></span>