[all-commits] [llvm/llvm-project] 9323ef: [InstCombine] Simplify binary op when only one ope...

jayfoad via All-commits all-commits at lists.llvm.org
Mon Nov 11 02:19:29 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 9323ef4ecca1095347627842c8bfa3544a59e718
      https://github.com/llvm/llvm-project/commit/9323ef4ecca1095347627842c8bfa3544a59e718
  Author: Jay Foad <jay.foad at amd.com>
  Date:   2019-11-11 (Mon, 11 Nov 2019)

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

  Log Message:
  -----------
  [InstCombine] Simplify binary op when only one operand is a select

Summary:
SimplifySelectsFeedingBinaryOp simplified binary ops when both operands
were selects with the same condition. This patch extends it to handle
these cases where only one operand is a select:

X op (C ? P : Q) -> C ? (X op P) : (X op Q)
  // if X op P and X op Q both simplify
(C ? P : Q) op Y -> C ? (P op Y) : (Q op Y)
  // if P op Y and Q op Y both simplify

For example: X *fast (C ? 1.0 : 0.0) -> C ? X : 0.0

Reviewers: mcberg2017, majnemer, craig.topper, qcolombet, mcrosier

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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




More information about the All-commits mailing list