[all-commits] [llvm/llvm-project] 535c5d: [InstCombine] ease restriction for extractelt (bit...

Sanjay Patel via All-commits all-commits at lists.llvm.org
Thu Nov 24 10:27:33 PST 2022


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

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
    M llvm/test/Transforms/InstCombine/bitcast-inseltpoison.ll
    M llvm/test/Transforms/InstCombine/bitcast.ll
    M llvm/test/Transforms/InstCombine/extractelement.ll

  Log Message:
  -----------
  [InstCombine] ease restriction for extractelt (bitcast X) fold

We were checking for a desirable integer type even when there
is no shift in the transform. This is unnecessary since we
are truncating directly to the destination type.

This removes an extractelt in more cases and seems to make the
canonicalization more uniform overall. There's still a potential
difference between patterns that need a shift vs. trunc-only.

I'm not sure if that is worth keeping at this point, but it can
be adjusted in another step (assuming this change does not cause
trouble).

In the most basic case where I noticed this, we missed a fold
that would have completely removed vector ops from a pattern
like:
https://alive2.llvm.org/ce/z/y4Qdte




More information about the All-commits mailing list