[all-commits] [llvm/llvm-project] 0aece7: [DAG] Fold select(cond, binop(x, y), binop(x, z)) -> b...

Simon Pilgrim via All-commits all-commits at lists.llvm.org
Thu Jul 15 08:19:15 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0aece73aba65b92770e63bc6c138e8b1a177d45f
      https://github.com/llvm/llvm-project/commit/0aece73aba65b92770e63bc6c138e8b1a177d45f
  Author: Simon Pilgrim <llvm-dev at redking.me.uk>
  Date:   2021-07-15 (Thu, 15 Jul 2021)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
    M llvm/test/CodeGen/X86/select.ll

  Log Message:
  -----------
  [DAG] Fold select(cond,binop(x,y),binop(x,z)) -> binop(x,select(cond,y,z))

Similar to the folds performed in InstCombinerImpl::foldSelectOpOp, this attempts to push a select further up to help merge a pair of binops.

I'm primarily interested in select(cond,add(x,y),add(x,z)) folds to help expose pointer math (see https://bugs.llvm.org/show_bug.cgi?id=51069 etc.) but I've tried to use the more generic isBinOp().

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




More information about the All-commits mailing list