[llvm] 1598dc8 - GISel/Combiner: maintain created instructions in a SetVector
Nicolai Hähnle via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 7 12:40:53 PST 2022
Author: Nicolai Hähnle
Date: 2022-12-07T21:40:34+01:00
New Revision: 1598dc84bd61226b19c3a012ee72498f1df66758
URL: https://github.com/llvm/llvm-project/commit/1598dc84bd61226b19c3a012ee72498f1df66758
DIFF: https://github.com/llvm/llvm-project/commit/1598dc84bd61226b19c3a012ee72498f1df66758.diff
LOG: GISel/Combiner: maintain created instructions in a SetVector
This is not a correctness fix because the set is only used for debug
output. However, it helps avoid noise when looking at diffs between
compiler runs.
The set is only maintained with debug output enabled, so the added cost
should be acceptable.
Differential Revision: https://reviews.llvm.org/D139465
Added:
Modified:
llvm/lib/CodeGen/GlobalISel/Combiner.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/GlobalISel/Combiner.cpp b/llvm/lib/CodeGen/GlobalISel/Combiner.cpp
index 5b1f20af168f..748fa273d499 100644
--- a/llvm/lib/CodeGen/GlobalISel/Combiner.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/Combiner.cpp
@@ -12,6 +12,7 @@
#include "llvm/CodeGen/GlobalISel/Combiner.h"
#include "llvm/ADT/PostOrderIterator.h"
+#include "llvm/ADT/SetVector.h"
#include "llvm/CodeGen/GlobalISel/CSEInfo.h"
#include "llvm/CodeGen/GlobalISel/CSEMIRBuilder.h"
#include "llvm/CodeGen/GlobalISel/CombinerInfo.h"
@@ -52,7 +53,9 @@ class WorkListMaintainer : public GISelChangeObserver {
WorkListTy &WorkList;
/// The instructions that have been created but we want to report once they
/// have their operands. This is only maintained if debug output is requested.
- SmallPtrSet<const MachineInstr *, 4> CreatedInstrs;
+#ifndef NDEBUG
+ SetVector<const MachineInstr *> CreatedInstrs;
+#endif
public:
WorkListMaintainer(WorkListTy &WorkList) : WorkList(WorkList) {}
More information about the llvm-commits
mailing list