<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/136816>136816</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            why clang use Ltmp lable
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          LukeSTM
      </td>
    </tr>
</table>

<pre>
    example:

```
#include <stdio.h>

typedef struct {
    volatile int counter;
} Counter;

void foo(Counter *v, int i) {
    int result, val, tmp;

    __asm__ __volatile__(
        ".arch_extension mp\n"                
 "9998:    " "pldw\t%a0" "\n"           
        "    .pushsection \".alt.smp.init\", \"a\"\n" 
        "  .long   9998b - .\n" 
        "  " "pld\t%a0" "\n"                   
 " .popsection\n"                       
        "1: ldrex   %0, [%4]\n"               
        "   add     %1, %0, %5\n" 
        "   strex   %2, %1, [%4]\n"             
        "   teq %2, #0\n"                  
        "   bne     1b" 
        : "=&r" (result), "=&r" (val), "=&r" (tmp), "+Qo" (v->counter) 
        : "r" (&v->counter), "Ir" (i)         
        : "cc"                                
    );

    printf("Updated counter: %d\n", v->counter);
}

int main() {
    Counter c = {0};

 printf("Initial counter: %d\n", c.counter);
    foo(&c, 5);

 return 0;
}```

https://godbolt.org/z/Px35ejvbn

Clang will split the `foo` function in the example into two parts, using `Ltmp0` to represent the embedded assembly logic in the source code. Why is this done?

</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyEVU1v4zYQ_TXjyyACTVqyfNDBsdfAAlugRVv0aFDixOKWIlWRcpL--oL62Dhy0hUUMJyPN29G5LP0Xl8sUQHpI6THlexD7briW_83_f7HL6vSqdeCXmTTGgKxBza8GZtetgcutK1MrwhBHHxQ2iU1iC9jZHhtSdET-tD1VUDYPgLbIyJenZFBG0JtA1aut4E6ENEL2yMe3hnY_uq0wifngOeTC4Hvr8APQ74GvrvBjqaOf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