Skip to content

[SelectionDAG] Correct the implementation of m_AllOnes. #90776

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions llvm/include/llvm/CodeGen/SDPatternMatch.h
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,17 @@ inline SpecificInt_match m_SpecificInt(uint64_t V) {

inline SpecificInt_match m_Zero() { return m_SpecificInt(0U); }
inline SpecificInt_match m_One() { return m_SpecificInt(1U); }
inline SpecificInt_match m_AllOnes() { return m_SpecificInt(~0U); }

struct AllOnes_match {

AllOnes_match() = default;

template <typename MatchContext> bool match(const MatchContext &, SDValue N) {
return isAllOnesOrAllOnesSplat(N);
}
};

inline AllOnes_match m_AllOnes() { return AllOnes_match(); }

/// Match true boolean value based on the information provided by
/// TargetLowering.
Expand Down Expand Up @@ -766,7 +776,7 @@ inline BinaryOpc_match<SpecificInt_match, ValTy> m_Neg(const ValTy &V) {

/// Match a Not as a xor(v, -1) or xor(-1, v)
template <typename ValTy>
inline BinaryOpc_match<ValTy, SpecificInt_match, true> m_Not(const ValTy &V) {
inline BinaryOpc_match<ValTy, AllOnes_match, true> m_Not(const ValTy &V) {
return m_Xor(V, m_AllOnes());
}

Expand Down
Loading