[all-commits] [llvm/llvm-project] e10958: [SelectionDAG][Mips][PowerPC][RISCV][WebAssembly] ...

Jessica Clarke via All-commits all-commits at lists.llvm.org
Thu May 20 12:34:47 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e10958c807f9091c3a69ce6506fa3b9579a8ca6a
      https://github.com/llvm/llvm-project/commit/e10958c807f9091c3a69ce6506fa3b9579a8ca6a
  Author: Jessica Clarke <jrtc27 at jrtc27.com>
  Date:   2021-05-20 (Thu, 20 May 2021)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
    M llvm/lib/Target/WebAssembly/WebAssemblyInstrAtomics.td
    M llvm/test/CodeGen/Mips/atomic.ll
    M llvm/test/CodeGen/PowerPC/atomics-i16-ldst.ll
    M llvm/test/CodeGen/PowerPC/atomics-i32-ldst.ll
    M llvm/test/CodeGen/PowerPC/atomics-i64-ldst.ll
    M llvm/test/CodeGen/PowerPC/atomics-i8-ldst.ll
    M llvm/test/CodeGen/PowerPC/ppc-partword-atomic.ll
    M llvm/test/CodeGen/RISCV/atomic-signext.ll

  Log Message:
  -----------
  [SelectionDAG][Mips][PowerPC][RISCV][WebAssembly] Teach computeKnownBits/ComputeNumSignBits about atomics

Unlike normal loads these don't have an extension field, but we know
from TargetLowering whether these are sign-extending or zero-extending,
and so can optimise away unnecessary extensions.

This was noticed on RISC-V, where sign extensions in the calling
convention would result in unnecessary explicit extension instructions,
but this also fixes some Mips inefficiencies. PowerPC sees churn in the
tests as all the zero extensions are only for promoting 32-bit to
64-bit, but these zero extensions are still not optimised away as they
should be, likely due to i32 being a legal type.

This also simplifies the WebAssembly code somewhat, which currently
works around the lack of target-independent combines with some ugly
patterns that break once they're optimised away.

Re-landed with correct handling in ComputeNumSignBits for Tmp == VTBits,
where zero-extending atomics were incorrectly returning 0 rather than
the (slightly confusing) required return value of 1.

Re-landed again after D102819 fixed PowerPC to correctly zero-extend all
of its atomics as it claimed to do, since the combination of that bug
and this optimisation caused buildbot regressions.

Reviewed By: RKSimon, atanasyan

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




More information about the All-commits mailing list