[all-commits] [llvm/llvm-project] 41466a: [SelectionDAG] Correct the implementation of m_All...

Craig Topper via All-commits all-commits at lists.llvm.org
Wed May 1 14:55:36 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 41466a177a95ee6ff699d190f7625f0b32922a20
      https://github.com/llvm/llvm-project/commit/41466a177a95ee6ff699d190f7625f0b32922a20
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2024-05-01 (Wed, 01 May 2024)

  Changed paths:
    M llvm/include/llvm/CodeGen/SDPatternMatch.h
    M llvm/test/CodeGen/X86/subvectorwise-store-of-vector-splat.ll

  Log Message:
  -----------
  [SelectionDAG] Correct the implementation of m_AllOnes. (#90776)

Previously we used SpecificInt_match which created a 64 bit APInt
containing all ones. This was then checked against other constants by
using APInt::isSameValue.

If the constnats have different bitwidths, APInt::isSameValue will zero
extend the constant to make them match. This means for any constant less
than 64 bits, m_AllOnes was guaranteed to fail since the zero extended
value would not match all ones.

I think would also incorrectly consider an i128 with 64 leading zeros
and 64 trailing zeros as matching m_AllOnes.

To avoid this, this patch adds a new matcher class that just calls
isAllOnesOrAllOnesSplat.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list