[PATCH] D111082: [InstCombine] fold fake vector extract to shift+trunc

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 4 11:28:57 PDT 2021


spatel created this revision.
spatel added reviewers: lebedev.ri, RKSimon, dmgreen, craig.topper.
Herald added subscribers: pengfei, hiraditya, mcrosier.
spatel requested review of this revision.
Herald added a project: LLVM.

We already handle more complicated cases like:
extelt (bitcast (inselt poison, X, 0)) --> trunc (lshr X)

But we missed this simpler pattern:
https://alive2.llvm.org/ce/z/D55h64

This is part of solving:
https://llvm.org/PR52057

I made the transform depend on legal/desirable int type to avoid creating a shift of an illegal type (for example i128). I'm not sure if that restriction is actually necessary, but we can change that as a follow-up if the backend can deal with integer ops on too-wide illegal types.

The pile of AVX512 test changes are all neutral AFAICT - the x86 backend seems to know how to turn that into the expected "kmov" instructions.


https://reviews.llvm.org/D111082

Files:
  llvm/lib/Transforms/InstCombine/InstCombineInternal.h
  llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
  llvm/test/Transforms/InstCombine/X86/x86-avx512-inseltpoison.ll
  llvm/test/Transforms/InstCombine/X86/x86-avx512.ll
  llvm/test/Transforms/InstCombine/extractelement.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111082.376957.patch
Type: text/x-patch
Size: 68093 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211004/c0b2d7c4/attachment.bin>


More information about the llvm-commits mailing list