Skip to content

Commit

Permalink
GISel/Combiner: maintain created instructions in a SetVector
Browse files Browse the repository at this point in the history
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
  • Loading branch information
nhaehnle committed Dec 7, 2022
1 parent f8f41c3 commit 1598dc8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion llvm/lib/CodeGen/GlobalISel/Combiner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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) {}
Expand Down

0 comments on commit 1598dc8

Please sign in to comment.