[all-commits] [llvm/llvm-project] cea980: [RISCV] Add tests for (and (add x, c1), (lshr y, c2))

hev via All-commits all-commits at lists.llvm.org
Mon Jul 24 01:52:37 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: cea980f380e1966892cf8a45064e46c757803bd1
      https://github.com/llvm/llvm-project/commit/cea980f380e1966892cf8a45064e46c757803bd1
  Author: WANG Rui <wangrui at loongson.cn>
  Date:   2023-07-24 (Mon, 24 Jul 2023)

  Changed paths:
    A llvm/test/CodeGen/RISCV/and-add-lsr.ll

  Log Message:
  -----------
  [RISCV] Add tests for (and (add x, c1), (lshr y, c2))

Add tests for (and (add x, c1), (lshr y, c2)).

Signed-off-by: WANG Rui <wangrui at loongson.cn>

Reviewed By: craig.topper

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


  Commit: 595d5f36f4f9cebccca9efaf0db4bc20cc44ea2f
      https://github.com/llvm/llvm-project/commit/595d5f36f4f9cebccca9efaf0db4bc20cc44ea2f
  Author: WANG Rui <wangrui at loongson.cn>
  Date:   2023-07-24 (Mon, 24 Jul 2023)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
    M llvm/test/CodeGen/RISCV/and-add-lsr.ll

  Log Message:
  -----------
  [DAGCombine] Canonicalize operands for visitANDLike

During the construction of SelectionDAG, there are no explicit canonicalization rules to adjust the order of operands for AND nodes.  This may prevent the optimization in DAGCombiner::visitANDLike from being triggered. This patch canonicalizes the operands before matches, which can be observed to improve optimization on the RISC-V target architecture.

Canonicalize:
```
and(x, add) -> and(add, x)
```

Signed-off-by: WANG Rui <wangrui at loongson.cn>

Reviewed By: RKSimon

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


Compare: https://github.com/llvm/llvm-project/compare/6865fbd3da94...595d5f36f4f9


More information about the All-commits mailing list