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

    <tr>
        <th>Summary</th>
        <td>
            assertion failure: inlinable function call in a function with debug info must have a !dbg location
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

    <tr>
      <th>Reporter</th>
      <td>
          yuanfang-chen
      </td>
    </tr>
</table>

<pre>
    This code when compiled with `clang -g -O1 -fsanitize=kernel-address -c x.c`
```c
void m();
void *memcpy(void *a, void *b, unsigned long c) {return 0;}
typedef struct {
  int a;
  int c;
} d;
typedef struct {
  d f;
  int g;
} h;
typedef struct {
  d f;
  h g;
} i;
void j() { memcpy(0, 0, 0); }
struct i *e;
int k(i l) {
  i b;
  b.g = l.g;
  e = &b;
  m();
  return 0;
}
i o;
int n() {
  k(o);
  return 0;
}
```

produces
```
inlinable function call in a function with debug info must have a !dbg location
  %18 = call ptr @memcpy(ptr %4, ptr @o, i64 20)
inlinable function call in a function with debug info must have a !dbg location
  %18 = call ptr @memcpy(ptr %4, ptr @o, i64 20)
fatal error: error in backend: Broken module found, compilation aborted!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
```

I traced it down to `HandleByValArgumentInit` where newly-inserted memcpy has no debug loc. I think we may attribute the memcpy to *some* debug loc. But the general problem is that the compiler could synthesize intrinsic calls without debug loc. Maybe we should suppress the assertion for intrinsic calls?

@adrian-prantl 

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzVVk2P4zYM_TXOhUhgy3E-Dj4knR10gRYt0KJ3WWJs7ciSoY9J019fSk4ymUFbtIu9FDAyIiU-PfLR9HRWXtpfB-VBWIlwHtDQapyURglnFQYoNqXQ3PSwpOenCpYnz40K6g8s6qcXdAb1kkvp0HtYCvh9JSiiKJ-K8pAW-RG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