[all-commits] [llvm/llvm-project] 87bc91: [PowerPC] Fix shuffle combine with undef elements ...

Nikita Popov via All-commits all-commits at lists.llvm.org
Mon Jan 15 01:12:45 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 87bc91d4259c53d98d8c5c6b7c622f65ddb4c62a
      https://github.com/llvm/llvm-project/commit/87bc91d4259c53d98d8c5c6b7c622f65ddb4c62a
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2024-01-15 (Mon, 15 Jan 2024)

  Changed paths:
    M llvm/lib/Target/PowerPC/PPCISelLowering.cpp
    M llvm/test/CodeGen/PowerPC/pr77748.ll

  Log Message:
  -----------
  [PowerPC] Fix shuffle combine with undef elements (#77787)

This custom DAG combine works on a shuffle where one source vector is a
zero splat, which means we can adjust the shuffle indices to refer to
any element of the splat -- as long as we stay in the same vector.

In the case where an undef (-1) index into the non-splat vector was
used, we ended up adjusting the splat index to -1+NumElements, which
points into the wrong vector.

Fix this by using the first element from the splat if the other one is undef.
There are four cases this theoretically affects, but in practice I only
managed to demonstrate a miscompile with one of them. I think two of
theses are effectively dead due to the operand canonicalization at the
start of the transform.

Fixes https://github.com/llvm/llvm-project/issues/77748.




More information about the All-commits mailing list