[PATCH] D87555: [DivRemPairs] Add an initial case for hoisting to a common predecessor.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 11 20:58:24 PDT 2020


craig.topper created this revision.
craig.topper added reviewers: spatel, lebedev.ri, RKSimon, efriedma.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.
craig.topper requested review of this revision.

This patch adds support for hoisting the division and maybe the
remainder for control flow graphs like this.

PredBB

  |  \
  |  Rem
  |  /

Div

If we have DivRem we'll hoist both to PredBB. If not we'll just
hoist Div and expand Rem using the Div.

This improves our codegen for something like this

__uint128_t udivmodti4(__uint128_t dividend, __uint128_t divisor, __uint128_t *remainder) {

  if (remainder != 0)
      *remainder = dividend % divisor;
  return dividend / divisor;

}


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D87555

Files:
  llvm/lib/Transforms/Scalar/DivRemPairs.cpp
  llvm/test/Transforms/DivRemPairs/X86/div-expanded-rem-pair.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87555.291372.patch
Type: text/x-patch
Size: 3831 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200912/5e7d58e3/attachment.bin>


More information about the llvm-commits mailing list