[all-commits] [llvm/llvm-project] 8a519b: [InstCombine] Ensure constant folding in binop of ...

Nikita Popov via All-commits all-commits at lists.llvm.org
Fri Jul 15 02:03:25 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8a519b3c214547dbd7b6a027d83ee5f79b5f09c0
      https://github.com/llvm/llvm-project/commit/8a519b3c214547dbd7b6a027d83ee5f79b5f09c0
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2022-07-15 (Fri, 15 Jul 2022)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
    M llvm/test/Transforms/InstCombine/select.ll

  Log Message:
  -----------
  [InstCombine] Ensure constant folding in binop of select fold

When folding a binop into a select, we need to ensure that one
of the select arms actually does constant fold, otherwise we'll
create two binop instructions and perform the reverse transform.

Ensure this by performing an explicit constant folding attempt,
and failing the transform if neither side simplifies.

A simple alternative here would have been to limit the fold to
ImmConstants, but given the current representation of scalable
vector splats, this wouldn't be ideal.




More information about the All-commits mailing list