-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[llvm-reduce] Remove DIGlobalVariableExpressions from DICompileUnit's globals #94497
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
… globals The 'metadata' delta pass will remove !dbg attachments from globals (which are DIGlobalVariableExpression nodes). The DIGlobalVariableExpressions don't get eliminated from the IR however if they are still referenced by the globals field in DICompileUnit. Teach the 'di-metadata' pass to try removing global variable operands from metadata tuples as well as DINodes.
@@ -15,18 +15,15 @@ | |||
; CHECK-INTERESTINGNESS-DAG: [[SUBPROG]] = distinct !DISubprogram(name: "test", | |||
|
|||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whitespace
|
||
TN.push_back(Tup->getOperand(I)); | ||
if (Metadata *Op = Tup->getOperand(I).get()) { | ||
if (isa<DINode>(Op) || isa<DIGlobalVariableExpression>(Op)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe it is possible to find nulls in the MD tree. Given the brute-force approach of this pass, I think isa_and_nonnull
makes more sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've guarded it with if (Metadata *Op = Tup->getOperand(I).get())
above this line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes. That's fine, then. One nit: The braces on this if statement are not necessary.
Thanks @ormris - I've addressed your comments |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After one nit, LGTM
|
||
TN.push_back(Tup->getOperand(I)); | ||
if (Metadata *Op = Tup->getOperand(I).get()) { | ||
if (isa<DINode>(Op) || isa<DIGlobalVariableExpression>(Op)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes. That's fine, then. One nit: The braces on this if statement are not necessary.
The 'metadata' delta pass will remove !dbg attachments from globals (which are DIGlobalVariableExpression nodes). The DIGlobalVariableExpressions don't get eliminated from the IR however if they are still referenced by the globals field in DICompileUnit.
Teach the 'di-metadata' pass to try removing global variable operands from metadata tuples as well as DINodes.