[all-commits] [llvm/llvm-project] 1b7612: [APInt] Add a simpler overload of multiplicativeIn...

Jay Foad via All-commits all-commits at lists.llvm.org
Thu Apr 4 08:11:29 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1b761205f2686516cebadbcbc37f798197d9c482
      https://github.com/llvm/llvm-project/commit/1b761205f2686516cebadbcbc37f798197d9c482
  Author: Jay Foad <jay.foad at amd.com>
  Date:   2024-04-04 (Thu, 04 Apr 2024)

  Changed paths:
    M llvm/include/llvm/ADT/APInt.h
    M llvm/lib/Analysis/ScalarEvolution.cpp
    M llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
    M llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
    M llvm/lib/Support/APInt.cpp
    M llvm/unittests/ADT/APIntTest.cpp

  Log Message:
  -----------
  [APInt] Add a simpler overload of multiplicativeInverse (#87610)

The current APInt::multiplicativeInverse takes a modulus which can be
any value, but all in-tree callers use a power of two. Moreover, most
callers want to use two to the power of the width of an existing APInt,
which is awkward because 2^N is not representable as an N-bit APInt.

Add a new overload of multiplicativeInverse which implicitly uses
2^BitWidth as the modulus.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list