[all-commits] [llvm/llvm-project] e71b81: [InstCombine] canonicalize trunc + insert as bitca...

Sanjay Patel via All-commits all-commits at lists.llvm.org
Wed Nov 30 11:52:34 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e71b81cab09bf33e3b08ed600418b72cc4117461
      https://github.com/llvm/llvm-project/commit/e71b81cab09bf33e3b08ed600418b72cc4117461
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2022-11-30 (Wed, 30 Nov 2022)

  Changed paths:
    M clang/test/Headers/wasm.c
    M llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
    M llvm/test/Transforms/InstCombine/insert-trunc.ll
    M llvm/test/Transforms/InstCombine/vec_phi_extract-inseltpoison.ll
    M llvm/test/Transforms/InstCombine/vec_phi_extract.ll
    M llvm/test/Transforms/LoopVectorize/ARM/pointer_iv.ll
    M llvm/test/Transforms/PhaseOrdering/X86/vec-load-combine.ll

  Log Message:
  -----------
  [InstCombine] canonicalize trunc + insert as bitcast + shuffle, part 1 (2nd try)

The first attempt was reverted because a clang test changed
unexpectedly - the file is already marked with a FIXME, so
I just updated it this time to pass.

Original commit message:
This is the main patch for converting a truncated scalar that is
inserted into a vector to bitcast+shuffle. We could go either way
on patterns like this, but this direction will allow collapsing a
pair of these sequences on the motivating example from issue

The patch is split into 3 parts to make it easier to see the
progression of tests diffs. We allow inserting/shuffling into a
different size vector for flexibility, so there are several test
variations. The length-changing is handled by shortening/padding
the shuffle mask with undef elements.

In part 1, handle the basic pattern:
inselt undef, (trunc T), IndexC --> shuffle (bitcast T), IdentityMask

Proof for the endian-dependency behaving as expected:
https://alive2.llvm.org/ce/z/BsA7yC

The TODO items for handling shifts and insert into an arbitrary base
vector value are implemented as follow-ups.

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




More information about the All-commits mailing list