[all-commits] [llvm/llvm-project] 4446f7: [InstCombine] try to fold a pair of insertelements...

Sanjay Patel via All-commits all-commits at lists.llvm.org
Mon Dec 12 07:55:48 PST 2022


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

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
    M llvm/test/Transforms/InstCombine/insertelt-trunc.ll
    M llvm/test/Transforms/PhaseOrdering/X86/vec-load-combine.ll

  Log Message:
  -----------
  [InstCombine] try to fold a pair of insertelements into one insertelement

This replaces patches that tried to convert related patterns to shuffles
(D138872, D138873, D138874 - reverted/abandoned) but caused codegen
problems and were questionable as a canonicalization because an
insertelement is a simpler op than a shuffle.

This detects a larger pattern -- insert-of-insert -- and replaces with
another insert, so this hopefully does not cause any problems.

As noted by TODO items in the code and tests, this could go a lot further.
But this is enough to reduce the motivating test from issue #17113.

Example proofs:
https://alive2.llvm.org/ce/z/NnUv3a

I drafted a version of this for AggressiveInstCombine, but it seems that
would uncover yet another phase ordering gap. If we do generalize this to
handle the full range of potential patterns, that may be worth looking at
again.

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




More information about the All-commits mailing list