[all-commits] [llvm/llvm-project] 2a48b6: [IR] In ConstantFoldShuffleVectorInstruction use z...

david-arm via All-commits all-commits at lists.llvm.org
Wed Nov 10 01:44:48 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2a48b6993a973e0ab2331e8c11dbd6e6100e2cfe
      https://github.com/llvm/llvm-project/commit/2a48b6993a973e0ab2331e8c11dbd6e6100e2cfe
  Author: David Sherwood <david.sherwood at arm.com>
  Date:   2021-11-10 (Wed, 10 Nov 2021)

  Changed paths:
    M clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_dupq.c
    M llvm/lib/IR/ConstantFold.cpp
    M llvm/test/Bitcode/vscale-round-trip.ll
    M llvm/test/Transforms/LoopVectorize/AArch64/scalable-strict-fadd.ll
    M llvm/test/Transforms/LoopVectorize/AArch64/sve-basic-vec.ll
    M llvm/test/Transforms/LoopVectorize/AArch64/sve-cond-inv-loads.ll
    M llvm/test/Transforms/LoopVectorize/AArch64/sve-inv-store.ll
    M llvm/test/Transforms/LoopVectorize/AArch64/sve-select-cmp.ll
    M llvm/test/Transforms/LoopVectorize/AArch64/sve-widen-gep.ll
    M llvm/test/Transforms/LoopVectorize/scalable-inductions.ll
    M llvm/test/Transforms/LoopVectorize/scalable-reduction-inloop.ll

  Log Message:
  -----------
  [IR] In ConstantFoldShuffleVectorInstruction use zeroinitializer for splats of 0

When creating a splat of 0 for scalable vectors we tend to create them
with using a combination of shufflevector and insertelement, i.e.

shufflevector (<vscale x 4 x i32> insertelement (<vscale x 4 x i32> poison, i32 0, i32 0),
               <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer)

However, for the case of a zero splat we can actually just replace the
above with zeroinitializer instead. This makes the IR a lot simpler and
easier to read. I have changed ConstantFoldShuffleVectorInstruction to
use zeroinitializer when creating a splat of integer 0 or FP +0.0 values.

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




More information about the All-commits mailing list