[all-commits] [llvm/llvm-project] 5bfbd9: [RISCV] Optimize all-constant mask BUILD_VECTORs

Fraser Cormack via All-commits all-commits at lists.llvm.org
Tue Mar 23 03:18:17 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5bfbd9d9382141467b3082834b99921c0dbd3d9a
      https://github.com/llvm/llvm-project/commit/5bfbd9d9382141467b3082834b99921c0dbd3d9a
  Author: Fraser Cormack <fraser at codeplay.com>
  Date:   2021-03-23 (Tue, 23 Mar 2021)

  Changed paths:
    M llvm/lib/Target/RISCV/RISCVISelLowering.cpp
    A llvm/test/CodeGen/RISCV/rvv/fixed-vectors-mask-buildvec.ll

  Log Message:
  -----------
  [RISCV] Optimize all-constant mask BUILD_VECTORs

This patch adds an optimization for mask-vector BUILD_VECTOR nodes whose
elements are all constants or undef. It lowers such operations by
building up the vector via a series of integer operations, in which
multiple mask elements are inserted into a vector at a time via
i8/i16/i32/i64 element types. The final result is then bitcast from that
integer vector.

We restrict this optimization in certain circumstances when optimizing
for size. If we are required to use more than one integer insert
operation, then it will likely increase code size compared with using a
load from a constant pool.

Reviewed By: craig.topper

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




More information about the All-commits mailing list