Skip to content

Commit bdfb113

Browse files
committed
Fix picking ByDeclaration strategy
Due to refactorings, the ByInstruction strategy was always picked. Fix that and only pick ByInstruction if there are opcodes that need it.
1 parent 6ff7d39 commit bdfb113

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

include/llvm-dialects/Dialect/OpMap.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,10 @@ template <typename ValueT> class OpMap final {
339339
m_dialectOps.empty();
340340
}
341341

342+
bool emptyCoreOpcodes() const {
343+
return m_coreOpcodes.empty();
344+
}
345+
342346
// --------------------------------------------------------------------------
343347
// Iterator definitions.
344348
// --------------------------------------------------------------------------

lib/Dialect/Visitor.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,8 @@ VisitorBase::VisitorBase(VisitorTemplate &&templ)
185185
: m_strategy(templ.m_strategy),
186186
m_projections(std::move(templ.m_projections)) {
187187
if (m_strategy == VisitorStrategy::Default) {
188-
m_strategy = templ.m_opMap.empty() ? VisitorStrategy::ByFunctionDeclaration
189-
: VisitorStrategy::ByInstruction;
188+
m_strategy = templ.m_opMap.emptyCoreOpcodes() ? VisitorStrategy::ByFunctionDeclaration
189+
: VisitorStrategy::ByInstruction;
190190
}
191191

192192
BuildHelper helper(*this, templ.m_handlers);

0 commit comments

Comments
 (0)