Open Quuxplusone opened 8 years ago
Bugzilla Link | PR28149 |
Status | NEW |
Importance | P normal |
Reported by | Wolfgang Pieb (Wolfgang_Pieb@playstation.sony.com) |
Reported on | 2016-06-15 17:12:35 -0700 |
Last modified on | 2019-06-06 03:34:32 -0700 |
Version | trunk |
Hardware | PC Windows NT |
CC | dblaikie@gmail.com, jeremy.morse.llvm@gmail.com, llvm-bugs@lists.llvm.org, paul_robinson@playstation.sony.com |
Fixed by commit(s) | |
Attachments | |
Blocks | |
Blocked by | |
See also |
In what other ways does the DWARF differ?
Does MyStruct::foo still exist, or did it get optimized away? I imagine that's probably the thing that was holding on to MyStruct (I'm guessing the 'str' variable got optimized away? Though slightly surprised if we didn't preserve it even without any location)
(In reply to comment #1)
> In what other ways does the DWARF differ?
>
> Does MyStruct::foo still exist, or did it get optimized away? I imagine
> that's probably the thing that was holding on to MyStruct (I'm guessing the
> 'str' variable got optimized away? Though slightly surprised if we didn't
> preserve it even without any location)
The only thing that is left is the subprogram DIE for "main".
And 'str' got optimized away, but even when the 'use' gets changed
to a 'printf' :
int main() {
MyStruct str{1, 2, 3, 4};
printf("%d %d %p\n", str.x, str.y, (void *)&str);
return 0;
}
the same thing happens. And still, with -O2 everything for MyStruct is
emitted.
Chances are the bug is that the variable gets lost - once it's optimized away, it's intentional/not surprising that the type goes away too.
In theory, at any optimization level, we should be emitting a list of variables attached to the subprogram and even those totally optimized away should be emitted - I'd suggest you look around that variable list handling to see where it's getting fouled up.