This is an archive of the discontinued LLVM Phabricator instance.

Remap metadata attached to global variables.
ClosedPublic

Authored by eugenis on May 2 2017, 5:41 PM.

Details

Summary

Fix for PR32577.
Global variables may have !associated metadata, which includes a reference to another global, and needs remapping.

Diff Detail

Repository
rL LLVM

Event Timeline

eugenis created this revision.May 2 2017, 5:41 PM
pcc accepted this revision.May 2 2017, 6:27 PM
pcc added a subscriber: dexonsmith.

LGTM

We were probably getting lucky with other metadata attachments for globals (e.g. !dbg), presumably these would need to be mapped as well if a global reference was reachable from DIGlobalVariable (I was under the impression that this was still possible with templates in some cases, but maybe this has been fixed -- @dexonsmith?).

This revision is now accepted and ready to land.May 2 2017, 6:27 PM
dexonsmith requested changes to this revision.May 2 2017, 8:38 PM
dexonsmith added a reviewer: aprantl.

This LGTM too.

I'm not sure if globals are still reachable via !dbg, but it certainly used to be possible. Adrian, do you know the current state?

This revision now requires changes to proceed.May 2 2017, 8:38 PM
dexonsmith accepted this revision.May 2 2017, 8:39 PM

(I must have misclicked somewhere.)

This revision is now accepted and ready to land.May 2 2017, 8:39 PM
aprantl edited edge metadata.May 3 2017, 8:58 AM

I'm not sure if globals are still reachable via !dbg, but it certainly used to be possible. Adrian, do you know the current state?

I'm not sure I understand your question:

Global variables can either be described as !dbg attachments to globals:

@a = global i32, !dbg !0
!0 = !DIGlobalVariableExpression(var: DIGlobalVariable(name: "a"...))

or via a DICompileUnit:

!0 = DICompileUnit(..., globals: !{!1})
!1 = !DIGlobalVariableExpression(var: DIGlobalVariable(name: "my_const", expr: DIExpression(DW_OP_constu, 23)))

LLVM globals cannot be referenced from metadata any more if that is what you meant.

eugenis closed this revision.May 4 2017, 4:42 PM

r302203