<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/54290>54290</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
DIE for the "this" parameter is missing `DW_AT_location` with the new PM under `-Og`
</td>
</tr>
<tr>
<th>Labels</th>
<td>
wrong-debug,
debuginfo
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
petrhosek
</td>
</tr>
</table>
<pre>
With the following test case:
```
extern "C" int printf(const char*,...);
class Printer {
public:
Printer(int start, int step, int end) : start_(start), step_(step), end_(end)
{}
void Run() {
for (int i = start_; i < end_; i += step_)
printf("%d\n", i); // line 8
}
private:
int start_;
int step_;
int end_;
};
int main() {
Printer p(1, 2, 10);
p.Run();
}
```
DIE for the "this" parameter is missing `DW_AT_location` when compiled with `-Og`. This used to work properly prior to Clang 13.0.0. We ran a bisect and found out this issue was introduced by the new PM.
The reason this showed up in Clang 13.0.0 is because that's when [new PM became the default](https://reviews.llvm.org/D95380), but the issue reproduces all the way back to https://github.com/llvm/llvm-project/commit/50f9e893f2c5c5c820da8d552ca8a64cd0029d65 it you pass `-fexperimental-new-pass-manager`.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJylVE2PszYQ_jVwGQU5JiRw4LC7aaUeqr6qVtrjysAQ3DU2ss3y5t93bEh2o_ZSVRBjz8czM89M3JjuWr9JP4AfEHqjlFmkvoBH56EVDpP8KWHnhN3WI9veeMSfHq2GhPMX-oHUHiZLa5_wsjU6YAzCJvwp4S9ZliW8SvLn73itEs7Bj-CDFpLTppzmRsn2HnvTE2iI4LywngBhPeB026PuKAKQ22rzTg6bcRVsgu0qCz5RRC5BsnpuiVESp_O6_zSygz9nTSYR-ZZfbyjZNRtJ8c63ePlzPG-464k_rwYx9hbjThKxlvCiS4oXHbdUyEoS-f1KLyipEcpbZufv3BHIp_BfHbpz834n-cbQo2RL7gv0sSfBZBTyH0Xf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