[all-commits] [llvm/llvm-project] 995d40: [InstCombine] reduce mul operands based on undeman...

Sanjay Patel via All-commits all-commits at lists.llvm.org
Thu Feb 10 05:11:56 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 995d400f3a3c3d47bad95551dad104f686c46305
      https://github.com/llvm/llvm-project/commit/995d400f3a3c3d47bad95551dad104f686c46305
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2022-02-10 (Thu, 10 Feb 2022)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
    M llvm/test/Transforms/InstCombine/and-or.ll
    M llvm/test/Transforms/InstCombine/icmp-mul-and.ll
    M llvm/test/Transforms/InstCombine/mul-inseltpoison.ll
    M llvm/test/Transforms/InstCombine/mul.ll

  Log Message:
  -----------
  [InstCombine] reduce mul operands based on undemanded high bits

We already do this in SDAG, but mul was left out of the fold
for unused high bits in IR.

The high bits of a mul's operands do not change the low bits
of the result:
https://alive2.llvm.org/ce/z/XRj5Ek

Verify some test diffs to confirm that they are correct:
https://alive2.llvm.org/ce/z/y_W8DW
https://alive2.llvm.org/ce/z/7DM5uf
https://alive2.llvm.org/ce/z/GDiHCK

This gets a fold that was presumed not possible in D114272:
https://alive2.llvm.org/ce/z/tAN-WY

Removing nsw/nuw is needed for general correctness (and is
also done in the codegen version), but we might be able to
recover more of those with better analysis.

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




More information about the All-commits mailing list