[PATCH] D135024: [PowerPC] Fix invalid cast for vector shuffles when lowering to the xxsplti32dx instruction.

Amy Kwan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 1 22:30:25 PDT 2022


amyk created this revision.
amyk added reviewers: PowerPC, nemanjai, w2yehia, ZarkoCA.
amyk added a project: PowerPC.
Herald added subscribers: shchenz, kbarton, hiraditya.
Herald added a project: All.
amyk requested review of this revision.
Herald added a project: LLVM.

When lowering vector shuffles into the xxsplti32dx instruction on Power10, we canonicalize the
right operand to be a `BUILD_VECTOR` and as a result, get the commuted vector shuffle node.

However, a vector shuffle will not always be returned as the result for a commuted vector shuffle. 
In such a scenario, this patch updates the original cast of a shuffle into a `dyn_cast<>` and checks if
the shuffle is a valid vector shuffle node prior to obtaining the commuted shuffle mask.

This patch also adds a new test case that demonstrates this scenario (primarily seen on 32-bit), and
was originally a crash prior to this fix.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D135024

Files:
  llvm/lib/Target/PowerPC/PPCISelLowering.cpp
  llvm/test/CodeGen/PowerPC/p10-splatImm32-undef.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D135024.464537.patch
Type: text/x-patch
Size: 6555 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221002/9ee3453f/attachment-0001.bin>


More information about the llvm-commits mailing list