[llvm-branch-commits] [mlir] [mlir][Transforms][NFC] `remove-dead-values`: Split `OperationToCleanup` (PR #173542)
Matthias Springer via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Dec 25 03:04:10 PST 2025
https://github.com/matthias-springer created https://github.com/llvm/llvm-project/pull/173542
The `callee` field does not make sense for op results. Split `OperationToCleanup` into `OperandsToCleanup` and `ResultsToCleanup`.
>From f5dadff4287f2bfdd7167ae990b0bdd2a67e7367 Mon Sep 17 00:00:00 2001
From: Matthias Springer <me at m-sp.org>
Date: Thu, 25 Dec 2025 11:02:13 +0000
Subject: [PATCH] [mlir][Transforms][NFC] `remove-dead-values`: Split
`OperationToCleanup`
---
mlir/lib/Transforms/RemoveDeadValues.cpp | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/mlir/lib/Transforms/RemoveDeadValues.cpp b/mlir/lib/Transforms/RemoveDeadValues.cpp
index 6c1f7ddc80184..62ce5e0bbb77e 100644
--- a/mlir/lib/Transforms/RemoveDeadValues.cpp
+++ b/mlir/lib/Transforms/RemoveDeadValues.cpp
@@ -86,7 +86,12 @@ struct FunctionToCleanUp {
BitVector nonLiveRets;
};
-struct OperationToCleanup {
+struct ResultsToCleanup {
+ Operation *op;
+ BitVector nonLive;
+};
+
+struct OperandsToCleanup {
Operation *op;
BitVector nonLive;
Operation *callee =
@@ -107,8 +112,8 @@ struct SuccessorOperandsToCleanup {
struct RDVFinalCleanupList {
SmallVector<Operation *> operations;
SmallVector<FunctionToCleanUp> functions;
- SmallVector<OperationToCleanup> operands;
- SmallVector<OperationToCleanup> results;
+ SmallVector<OperandsToCleanup> operands;
+ SmallVector<ResultsToCleanup> results;
SmallVector<BlockArgsToCleanup> blocks;
SmallVector<SuccessorOperandsToCleanup> successorOperands;
};
@@ -875,7 +880,7 @@ static void cleanUpDeadVals(RDVFinalCleanupList &list) {
// 5. Operands
LDBG() << "Cleaning up " << list.operands.size() << " operand lists";
- for (OperationToCleanup &o : list.operands) {
+ for (OperandsToCleanup &o : list.operands) {
// Handle call-specific cleanup only when we have a cached callee reference.
// This avoids expensive symbol lookup and is defensive against future
// changes.
More information about the llvm-branch-commits
mailing list