[all-commits] [llvm/llvm-project] eea53b: [DAGCombiner] Optimize SMULO/UMULO if we can prove...

Craig Topper via All-commits all-commits at lists.llvm.org
Fri Feb 26 15:25:03 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: eea53b142d91c6dc8aae2a9727b4f48508d7b147
      https://github.com/llvm/llvm-project/commit/eea53b142d91c6dc8aae2a9727b4f48508d7b147
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2021-02-26 (Fri, 26 Feb 2021)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
    M llvm/test/CodeGen/AArch64/vec_umulo.ll
    M llvm/test/CodeGen/RISCV/xaluo.ll
    M llvm/test/CodeGen/X86/vec_smulo.ll
    M llvm/test/CodeGen/X86/vec_umulo.ll

  Log Message:
  -----------
  [DAGCombiner] Optimize SMULO/UMULO if we can prove that overflow is impossible.

Using ComputeNumSignBits or computeKnownBits we might be able
to determine that overflow is impossible.

This especially helps after type legalization if the type was
promoted from a type with half the bits or more. Type legalization
conservatively creates a promoted smulo/umulo and an overflow
check for the promoted bits. The overflow from the promoted
smulo/umulo is ORed with the result of the promoted bits
overflow check. Proving that the promoted smulo/umulo can never
overflow will leave us with just the promoted bits overflow check.

Reviewed By: RKSimon

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




More information about the All-commits mailing list