[all-commits] [llvm/llvm-project] 58c01e: [SelectionDAG] Merge FoldConstantVectorArithmetic ...

Simon Pilgrim via All-commits all-commits at lists.llvm.org
Tue Nov 9 03:31:23 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 58c01ef270dfb9de569133213fd6b6a7bcf8ded3
      https://github.com/llvm/llvm-project/commit/58c01ef270dfb9de569133213fd6b6a7bcf8ded3
  Author: Simon Pilgrim <llvm-dev at redking.me.uk>
  Date:   2021-11-09 (Tue, 09 Nov 2021)

  Changed paths:
    M llvm/include/llvm/CodeGen/SelectionDAG.h
    M llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
    M llvm/test/CodeGen/RISCV/urem-seteq-illegal-types.ll
    M llvm/test/CodeGen/X86/vselect-constants.ll

  Log Message:
  -----------
  [SelectionDAG] Merge FoldConstantVectorArithmetic into FoldConstantArithmetic (PR36544)

This patch merges FoldConstantVectorArithmetic back into FoldConstantArithmetic.

Like FoldConstantVectorArithmetic we now handle vector ops with any operand count, but we currently still only handle binops for scalar types - this can be improved in future patches - in particular some common unary/trinary ops still have poor constant folding.

There's one change in functionality causing test changes - FoldConstantVectorArithmetic bails early if the build/splat vector isn't all constant (with some undefs) elements, but FoldConstantArithmetic doesn't - it instead attempts to fold the scalar nodes and bails if they fail to regenerate a constant/undef result, allowing some additional identity/undef patterns to be handled.

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




More information about the All-commits mailing list