[all-commits] [llvm/llvm-project] c8bd53: [DAGCombiner][RISCV] Pre-promote (zext (abs X)) to...

Craig Topper via All-commits all-commits at lists.llvm.org
Fri Jan 13 10:41:50 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c8bd5343df642f98966cea7aabc6b26144ec87e1
      https://github.com/llvm/llvm-project/commit/c8bd5343df642f98966cea7aabc6b26144ec87e1
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2023-01-13 (Fri, 13 Jan 2023)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
    M llvm/test/CodeGen/RISCV/iabs.ll

  Log Message:
  -----------
  [DAGCombiner][RISCV] Pre-promote (zext (abs X)) to (abs (sext X)) when X has an illegal type.

Type legalization will insert a sign extend anyway. By doing it
early we can remove the zext. ComputeNumSignBits can't spot it
after type legalization because type legalization may expand
the abs to sra+xor+sub.

If the zext result type is larger than the type to be promoted to,
we'll promote to a legal type and then zext the rest of the way.
If the legal type is larger than the destination type we can promote
and then truncate.

Reviewed By: asb

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


  Commit: f48d637cd78c85ac890f064a2c2c5d5c075b47ca
      https://github.com/llvm/llvm-project/commit/f48d637cd78c85ac890f064a2c2c5d5c075b47ca
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2023-01-13 (Fri, 13 Jan 2023)

  Changed paths:
    M llvm/lib/Analysis/GlobalsModRef.cpp

  Log Message:
  -----------
  [Analysis] Use isa instead of dyn_cast to suppress an unused variable warning. NFC


Compare: https://github.com/llvm/llvm-project/compare/8b7c1fbd9647...f48d637cd78c


More information about the All-commits mailing list