aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools
diff options
context:
space:
mode:
authorOrlando Cazalet-Hyams <orlando.hyams@sony.com>2024-06-06 09:31:17 +0100
committerGitHub <noreply@github.com>2024-06-06 09:31:17 +0100
commitc2e62c745996cbd4e19ac1ffcafc849960377b57 (patch)
tree1aa7b244caa2e71e188e0d70c7f8fdedd38716be /llvm/tools
parentf1e78f776908f2bc1759eae25381f576f62728a2 (diff)
downloadllvm-c2e62c745996cbd4e19ac1ffcafc849960377b57.zip
llvm-c2e62c745996cbd4e19ac1ffcafc849960377b57.tar.gz
llvm-c2e62c745996cbd4e19ac1ffcafc849960377b57.tar.bz2
[llvm-reduce] Remove DIGlobalVariableExpressions from DICompileUnit's globals (#94497)
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.
Diffstat (limited to 'llvm/tools')
-rw-r--r--llvm/tools/llvm-reduce/deltas/ReduceDIMetadata.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceDIMetadata.cpp b/llvm/tools/llvm-reduce/deltas/ReduceDIMetadata.cpp
index f4d8496..38352d634 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceDIMetadata.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceDIMetadata.cpp
@@ -65,12 +65,13 @@ void identifyUninterestingMDNodes(Oracle &O, MDNodeList &MDs) {
SmallVector<Metadata *, 16> TN;
for (size_t I = 0; I < Tup->getNumOperands(); ++I) {
// Ignore any operands that are not DebugInfo metadata nodes.
- if (isa_and_nonnull<DINode>(Tup->getOperand(I)))
- // Don't add uninteresting operands to the tuple.
- if (!O.shouldKeep())
- continue;
-
- TN.push_back(Tup->getOperand(I));
+ if (Metadata *Op = Tup->getOperand(I).get()) {
+ if (isa<DINode>(Op) || isa<DIGlobalVariableExpression>(Op))
+ // Don't add uninteresting operands to the tuple.
+ if (!O.shouldKeep())
+ continue;
+ TN.push_back(Op);
+ }
}
if (TN.size() != Tup->getNumOperands())
DbgNode->replaceOperandWith(OpIdx, DbgNode->get(DbgNode->getContext(), TN));