[all-commits] [llvm/llvm-project] 88e85a: Handle simple diamond CFG hoisting in DivRemPairs.

Owen Anderson via All-commits all-commits at lists.llvm.org
Wed Dec 28 10:24:33 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 88e85aa580062c0f2b5882eef71bed498a6af159
      https://github.com/llvm/llvm-project/commit/88e85aa580062c0f2b5882eef71bed498a6af159
  Author: Owen Anderson <resistor at mac.com>
  Date:   2022-12-28 (Wed, 28 Dec 2022)

  Changed paths:
    M llvm/lib/Transforms/Scalar/DivRemPairs.cpp
    A llvm/test/Transforms/DivRemPairs/MSP430/div-rem-pairs.ll
    M llvm/test/Transforms/DivRemPairs/Mips/div-rem-pairs.ll
    M llvm/test/Transforms/DivRemPairs/PowerPC/div-rem-pairs.ll
    A llvm/test/Transforms/DivRemPairs/RISCV/div-rem-pairs.ll
    M llvm/test/Transforms/DivRemPairs/X86/div-expanded-rem-pair.ll
    M llvm/test/Transforms/DivRemPairs/X86/div-rem-pairs.ll

  Log Message:
  -----------
  Handle simple diamond CFG hoisting in DivRemPairs.

Previous we only handled triangle CFGs. This patch expands that
to support diamonds, where the div and rem appear in the then/else
sides of a condition. In that case, we can hoist the div into the
shared predecessor.

This could be generalized further to use nearest common ancestors,
but some of the conditions for hoisting would then require
post-dominator information.

Reviewed By: nikic, lebedev.ri

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




More information about the All-commits mailing list