Skip to content

Commit

Permalink
Fix picking ByDeclaration strategy
Browse files Browse the repository at this point in the history
Due to refactorings, the ByInstruction strategy was always picked.
Fix that and only pick ByInstruction if there are opcodes that need it.
  • Loading branch information
Flakebi committed Aug 27, 2024
1 parent 6ff7d39 commit bdfb113
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions include/llvm-dialects/Dialect/OpMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,10 @@ template <typename ValueT> class OpMap final {
m_dialectOps.empty();
}

bool emptyCoreOpcodes() const {
return m_coreOpcodes.empty();
}

// --------------------------------------------------------------------------
// Iterator definitions.
// --------------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions lib/Dialect/Visitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ VisitorBase::VisitorBase(VisitorTemplate &&templ)
: m_strategy(templ.m_strategy),
m_projections(std::move(templ.m_projections)) {
if (m_strategy == VisitorStrategy::Default) {
m_strategy = templ.m_opMap.empty() ? VisitorStrategy::ByFunctionDeclaration
: VisitorStrategy::ByInstruction;
m_strategy = templ.m_opMap.emptyCoreOpcodes() ? VisitorStrategy::ByFunctionDeclaration
: VisitorStrategy::ByInstruction;
}

BuildHelper helper(*this, templ.m_handlers);
Expand Down

0 comments on commit bdfb113

Please sign in to comment.