[llvm] [llvm-reduce] Fix incorrectly ignored null MD in ReduceDIMetadata (PR #108541)
Stephen Tozer via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 13 04:47:18 PDT 2024
https://github.com/SLTozer created https://github.com/llvm/llvm-project/pull/108541
Commit c2e62c7 updated the ReduceDIMetadata pass to be able to remove DIGlobalVariableExpressions from MDNode operands; it also accidentally prevented null operands from being preserved, which results in an assertion being triggered:
`Targets == NoChunksCounter.count() && "number of chunks changes when reducing"'
This patch allows us to correctly preserve null operands once again. I've not got a test case for this yet - I'm hoping this patch is just trivially correct as-is, because I've not got the hang of reducing a test case for llvm-reduce yet, but I can get a test case generated if needed.
>From 1fabbdbf4edf569d173cd3a2ce56df6c0054c308 Mon Sep 17 00:00:00 2001
From: Stephen Tozer <stephen.tozer at sony.com>
Date: Fri, 13 Sep 2024 12:39:00 +0100
Subject: [PATCH] [llvm-reduce] Fix incorrectly ignored null MD in
ReduceDIMetadata
Commit c2e62c7 updated the ReduceDIMetadata pass to be able to remove
DIGlobalVariableExpressions from MDNode operands; it also accidentally
prevented null operands from being preserved, which results in an
assertion being triggered:
`Targets == NoChunksCounter.count() && "number of chunks changes when reducing"'
This patch allows us to correctly preserve null operands once again.
---
llvm/tools/llvm-reduce/deltas/ReduceDIMetadata.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceDIMetadata.cpp b/llvm/tools/llvm-reduce/deltas/ReduceDIMetadata.cpp
index 38352d6342d4f9..fbad6f697584ee 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceDIMetadata.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceDIMetadata.cpp
@@ -70,8 +70,8 @@ void identifyUninterestingMDNodes(Oracle &O, MDNodeList &MDs) {
// Don't add uninteresting operands to the tuple.
if (!O.shouldKeep())
continue;
- TN.push_back(Op);
}
+ TN.push_back(Tup->getOperand(I));
}
if (TN.size() != Tup->getNumOperands())
DbgNode->replaceOperandWith(OpIdx, DbgNode->get(DbgNode->getContext(), TN));
More information about the llvm-commits
mailing list