[all-commits] [llvm/llvm-project] 396cda: [PatternMatch] Allow poison in api_pred_ty matcher...

Nikita Popov via All-commits all-commits at lists.llvm.org
Thu Apr 18 17:10:54 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 396cdabe47f3596464b289d0937c0066f50a0ac6
      https://github.com/llvm/llvm-project/commit/396cdabe47f3596464b289d0937c0066f50a0ac6
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2024-04-19 (Fri, 19 Apr 2024)

  Changed paths:
    M llvm/include/llvm/IR/PatternMatch.h
    M llvm/test/Transforms/InstCombine/select-with-bitwise-ops.ll
    M llvm/test/Transforms/InstCombine/signed-truncation-check.ll

  Log Message:
  -----------
  [PatternMatch] Allow poison in api_pred_ty matchers (#89188)

This allows vector splats containing poison for matchers using
api_pred_ty, making the behavior consistent with cst_pred_ty. In other
words, previously `m_NonNegative()` allowed splats with poison, while
`m_NonNegative(C)` did not. Now both allow them.

The affected matchers are m_MaxSignedValue, m_Negative, m_NonNegative,
m_StrictlyPositive, m_NonPositive, m_Power2, m_Power2OrZero,
m_NegatedPower2, m_NegatedPower2OrZero, m_LowBitMask and
m_LowBitMaskOrZero when passing in APInt.

I briefly went through the uses of these matchers and didn't spot any
places where allowing poison would be obviously wrong (I initially
thought foldSelectICmpAndBinOp is problematic, but because it does not
reuse the original constants, it's fine).

A problem here is that, despite these matchers appearing in a decent
number of places, we have very little pre-existing test coverage for
these folds with poison vectors, so we don't benefit from alive2
verification.



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