[all-commits] [llvm/llvm-project] cfff88: [InstCombine] Simplify select operand based on equ...

Nikita Popov via All-commits all-commits at lists.llvm.org
Mon Sep 14 11:08:36 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: cfff88c03cf9e9b72906a41fd11e06721d54f293
      https://github.com/llvm/llvm-project/commit/cfff88c03cf9e9b72906a41fd11e06721d54f293
  Author: Nikita Popov <nikita.ppv at gmail.com>
  Date:   2020-09-14 (Mon, 14 Sep 2020)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
    M llvm/test/Transforms/InstCombine/rem.ll
    M llvm/test/Transforms/InstCombine/select-binop-cmp.ll
    M llvm/test/Transforms/InstCombine/select.ll

  Log Message:
  -----------
  [InstCombine] Simplify select operand based on equality condition

For selects of the type X == Y ? A : B, check if we can simplify A
by using the X == Y equality and replace the operand if that's
possible. We already try to do this in InstSimplify, but will only
fold if the result of the simplification is the same as B, in which
case the select can be dropped entirely. Here the select will be
retained, just one operand simplified.

As we are performing an actual replacement here, we don't have
problems with refinement / poison values.

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




More information about the All-commits mailing list