[all-commits] [llvm/llvm-project] b7c7fe: [InstCombine] improve efficiency of bool logic; NFC

Sanjay Patel via All-commits all-commits at lists.llvm.org
Thu Dec 1 11:47:53 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b7c7fe3d0779b6e332fe6db64e87561deba2e56a
      https://github.com/llvm/llvm-project/commit/b7c7fe3d0779b6e332fe6db64e87561deba2e56a
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2022-12-01 (Thu, 01 Dec 2022)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp

  Log Message:
  -----------
  [InstCombine] improve efficiency of bool logic; NFC

As noted in issue #59266, the logic reduction could be
beyond the capabilities of an optimizing compiler, and
the code with ternary op is easier to read either way.


  Commit: dd8d0d21ce6d0665ef5d426372096aaed85b479a
      https://github.com/llvm/llvm-project/commit/dd8d0d21ce6d0665ef5d426372096aaed85b479a
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2022-12-01 (Thu, 01 Dec 2022)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
    M llvm/test/Transforms/InstCombine/insert-trunc.ll

  Log Message:
  -----------
  [InstCombine] canonicalize trunc + insert as bitcast + shuffle, part 2

This enhances the base fold from part 1 to allow mapping a
right-shift to an insert index.

Example of translating a middle chunk of the scalar to vector
for either endian:
https://alive2.llvm.org/ce/z/fRXCOZ

This only allows creating an identity shuffle (with optional
shortening/lengthening) because that is considered the safe
baseline for any target (can be inverted if needed). If we
tried this fold with target-specific costs/legality, then we
could do the transform more generally.

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


Compare: https://github.com/llvm/llvm-project/compare/2191137dff5e...dd8d0d21ce6d


More information about the All-commits mailing list