[all-commits] [llvm/llvm-project] 274b24: [ConstantRange] Add fast signed multiply

Nikita Popov via All-commits all-commits at lists.llvm.org
Sun Oct 17 07:42:31 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 274b2439f8392796e04e366ce5ff47434bd077e1
      https://github.com/llvm/llvm-project/commit/274b2439f8392796e04e366ce5ff47434bd077e1
  Author: Nikita Popov <nikita.ppv at gmail.com>
  Date:   2021-10-17 (Sun, 17 Oct 2021)

  Changed paths:
    M llvm/include/llvm/IR/ConstantRange.h
    M llvm/lib/Analysis/BasicAliasAnalysis.cpp
    M llvm/lib/IR/ConstantRange.cpp
    M llvm/unittests/IR/ConstantRangeTest.cpp

  Log Message:
  -----------
  [ConstantRange] Add fast signed multiply

The multiply() implementation is very slow -- it performs six
multiplications in double the bitwidth, which means that it will
typically work on allocated APInts and bypass fast-path
implementations. Add an additional implementation that doesn't
try to produce anything better than a full range if overflow is
possible. At least for the BasicAA use-case, we really don't care
about more precise modeling of overflow behavior. The current
use of multiply() is fine while the implementation is limited to
a single index, but extending it to the multiple-index case makes
the compile-time impact untenable.




More information about the All-commits mailing list