[all-commits] [llvm/llvm-project] 20ecc0: [MachineCombiner] Lift same-bb restriction for rea...

Florian Hahn via All-commits all-commits at lists.llvm.org
Fri Jan 13 07:33:27 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 20ecc0799146db11cdb7cab04184ee33620692f9
      https://github.com/llvm/llvm-project/commit/20ecc0799146db11cdb7cab04184ee33620692f9
  Author: Florian Hahn <flo at fhahn.com>
  Date:   2023-01-13 (Fri, 13 Jan 2023)

  Changed paths:
    M llvm/lib/CodeGen/TargetInstrInfo.cpp
    M llvm/test/CodeGen/AArch64/machine-combiner-reassociate-ops-in-different-blocks.mir
    M llvm/test/CodeGen/RISCV/fpclamptosat.ll
    M llvm/test/CodeGen/RISCV/fpclamptosat_vec.ll
    M llvm/test/CodeGen/RISCV/iabs.ll
    M llvm/test/CodeGen/RISCV/mul.ll
    M llvm/test/CodeGen/RISCV/neg-abs.ll
    M llvm/test/CodeGen/RISCV/rotl-rotr.ll
    M llvm/test/CodeGen/RISCV/rv32zbb.ll
    M llvm/test/CodeGen/RISCV/rv64i-w-insts-legalization.ll
    M llvm/test/CodeGen/RISCV/rvv/fixed-vector-strided-load-store-asm.ll
    M llvm/test/CodeGen/RISCV/rvv/fixed-vectors-reduction-mask-vp.ll
    M llvm/test/CodeGen/RISCV/rvv/vreductions-mask-vp.ll
    M llvm/test/CodeGen/RISCV/sextw-removal.ll
    M llvm/test/CodeGen/RISCV/wide-scalar-shift-by-byte-multiple-legalization.ll
    M llvm/test/CodeGen/RISCV/wide-scalar-shift-legalization.ll
    M llvm/test/CodeGen/X86/AMX/amx-greedy-ra-spill-shape.ll
    M llvm/test/CodeGen/X86/mul-constant-result.ll
    M llvm/test/CodeGen/X86/optimize-max-0.ll
    M llvm/test/Transforms/LoopStrengthReduce/X86/ivchain-X86.ll

  Log Message:
  -----------
  [MachineCombiner] Lift same-bb restriction for reassociable ops.

This patch relaxes the restriction that both reassociate operands must
be in the same block as the root instruction.

The comment indicates that the reason for this restriction was that the
operands not in the same block won't have a depth in the trace.

I believe this is outdated; if the operand is in a different block, it
must dominate the current block (otherwise it would need to be phi),
which in turn means the operand's block must be included in the current
rance, and depths must be available.

There's a test case (no_reassociate_different_block) added in
70520e2f1c5fc4 which shows that we have accurate depths for operands
defined in other blocks.

This allows reassociation of code that computes the final reduction
value after vectorization, among other things.

Reviewed By: dmgreen

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




More information about the All-commits mailing list