[all-commits] [llvm/llvm-project] 3e39b2: [llvm/CodeGen] Add ExpandLargeDivRem pass

Matthias Gehre via All-commits all-commits at lists.llvm.org
Fri Aug 26 03:55:34 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3e39b271016837425038e55e57c39e5e9b289975
  Author: Matthias Gehre <matthias.gehre at xilinx.com>
  Date:   2022-08-26 (Fri, 26 Aug 2022)

  Changed paths:
    A llvm/include/llvm/CodeGen/ExpandLargeDivRem.h
    M llvm/include/llvm/CodeGen/MachinePassRegistry.def
    M llvm/include/llvm/CodeGen/Passes.h
    M llvm/include/llvm/InitializePasses.h
    M llvm/include/llvm/LinkAllPasses.h
    M llvm/lib/CodeGen/CMakeLists.txt
    M llvm/lib/CodeGen/CodeGen.cpp
    A llvm/lib/CodeGen/ExpandLargeDivRem.cpp
    M llvm/lib/Transforms/Utils/IntegerDivision.cpp
    M llvm/test/CodeGen/X86/urem-seteq.ll
    A llvm/test/Transforms/ExpandLargeDivRem/sdiv129.ll
    A llvm/test/Transforms/ExpandLargeDivRem/srem129.ll
    A llvm/test/Transforms/ExpandLargeDivRem/udiv129.ll
    A llvm/test/Transforms/ExpandLargeDivRem/urem129.ll
    M llvm/tools/opt/opt.cpp

  Log Message:
  [llvm/CodeGen] Add ExpandLargeDivRem pass

Adds a pass ExpandLargeDivRem to expand div/rem instructions
with more than 128 bits into a loop computing that value.

As discussed on https://reviews.llvm.org/D120327, this approach has the advantage
that it is independent of the runtime library. This also helps the clang driver,
which otherwise would need to understand enough about the runtime library
to know whether to allow _BitInts with more than 128 bits.

Targets are still free to disable this pass and instead provide a faster
implementation in a runtime library.

Fixes https://github.com/llvm/llvm-project/issues/44994

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

More information about the All-commits mailing list