[all-commits] [llvm/llvm-project] 7964c3: [X86] `detectAVGPattern()`: small preparatory NFC ...

Roman Lebedev via All-commits all-commits at lists.llvm.org
Tue Oct 12 09:52:14 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7964c3ed8224239838429fce67fd872adeed348b
      https://github.com/llvm/llvm-project/commit/7964c3ed8224239838429fce67fd872adeed348b
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2021-10-12 (Tue, 12 Oct 2021)

  Changed paths:
    M llvm/lib/Target/X86/X86ISelLowering.cpp

  Log Message:
  -----------
  [X86] `detectAVGPattern()`: small preparatory NFC refactor


  Commit: 5f4f5da634ce196210c47ddf3d3a011c4c7e254f
      https://github.com/llvm/llvm-project/commit/5f4f5da634ce196210c47ddf3d3a011c4c7e254f
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2021-10-12 (Tue, 12 Oct 2021)

  Changed paths:
    M llvm/lib/Target/X86/X86ISelLowering.cpp
    M llvm/test/CodeGen/X86/avg.ll

  Log Message:
  -----------
  [X86] `detectAVGPattern()`: support basic case of PAVG chaining (PR52131)

As noted in https://github.com/halide/Halide/pull/6302,
we hilariously fail to match PAVG if we even as much
as look at it the wrong way.

In this particular case, the problem stems from the fact that
`PAVG` root (def) is a `trunc`, and leafs (uses) are `zext`'s,
and InstCombine really loves to get rid of both of these,
for example replace them with a bit mask. So we may not have
said `zext`.

Instead of checking for that + type match,
i think we should rely on the actual active type,
as per the knownbits.

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D111571


Compare: https://github.com/llvm/llvm-project/compare/fe2d053c4505...5f4f5da634ce


More information about the All-commits mailing list