[all-commits] [llvm/llvm-project] aec9cb: [SelectionDAG] Extend FoldConstantVectorArithmetic...

Fraser Cormack via All-commits all-commits at lists.llvm.org
Fri Jun 4 02:01:33 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: aec9cbbeb863dbd3ea362f99eb8b84dfbdb568a2
      https://github.com/llvm/llvm-project/commit/aec9cbbeb863dbd3ea362f99eb8b84dfbdb568a2
  Author: Fraser Cormack <fraser at codeplay.com>
  Date:   2021-06-04 (Fri, 04 Jun 2021)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
    M llvm/test/CodeGen/AArch64/sve-expand-div.ll
    M llvm/test/CodeGen/Hexagon/isel-memory-vNi1.ll
    A llvm/test/CodeGen/RISCV/rvv/constant-folding.ll
    M llvm/test/CodeGen/RISCV/rvv/setcc-integer-rv32.ll
    M llvm/test/CodeGen/RISCV/rvv/vdivu-sdnode-rv32.ll
    M llvm/test/CodeGen/RISCV/rvv/vdivu-sdnode-rv64.ll
    M llvm/test/CodeGen/RISCV/rvv/vremu-sdnode-rv32.ll
    M llvm/test/CodeGen/RISCV/rvv/vremu-sdnode-rv64.ll

  Log Message:
  -----------
  [SelectionDAG] Extend FoldConstantVectorArithmetic to SPLAT_VECTOR

This patch extends the SelectionDAG's ability to constant-fold vector
arithmetic to include support for SPLAT_VECTOR. This is not only for
scalable-vector types but also for fixed-length vector types, which
helps Hexagon in a couple of cases.

The original RISC-V test case was in fact an infinite DAGCombine loop.
The pattern `and (truncate v1), (truncate v2)` can be combined to
`truncate (and v1, v2)` but the truncate can similarly be combined back
to `truncate (and v1, v2)` (but, crucially, only when one of `v1` or
`v2` is a constant vector).

It wasn't exposed in on fixed-length types because a TRUNCATE of a
constant BUILD_VECTOR was folded into the BUILD_VECTOR itself, whereas
this did not happen for the equivalent (scalable-vector) SPLAT_VECTOR.

Reviewed By: RKSimon, craig.topper

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




More information about the All-commits mailing list