[all-commits] [llvm/llvm-project] 470aea: [InstCombine] Fold extractelt with select of const...

Thomas Symalla via All-commits all-commits at lists.llvm.org
Tue Nov 22 05:07:22 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 470aea5ed403d43b68e2ffdbec451d79913eb15d
      https://github.com/llvm/llvm-project/commit/470aea5ed403d43b68e2ffdbec451d79913eb15d
  Author: Thomas Symalla <github at thomassymalla.de>
  Date:   2022-11-22 (Tue, 22 Nov 2022)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
    M llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
    M llvm/test/Transforms/InstCombine/extractelement.ll
    M llvm/test/Transforms/InstCombine/shufflevector-div-rem-inseltpoison.ll
    M llvm/test/Transforms/InstCombine/shufflevector-div-rem.ll

  Log Message:
  -----------
  [InstCombine] Fold extractelt with select of constants

An extractelt with a constant index which extracts an element from the
two vector operands of a select can be directly folded into a select.

extractelt (select %x, %vec1, %vec2), %const ->
select %x, %vec1[%const], %vec2[%const]

Note: the implementation currently only works for constant vector operands.

Reviewed By: foad, spatel

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




More information about the All-commits mailing list