[PATCH] D65298: [DivRemPairs] Handling for expanded-form rem - recomposition (PR42673)

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 25 13:38:42 PDT 2019


lebedev.ri created this revision.
lebedev.ri added reviewers: spatel, RKSimon, efriedma, ZaMaZaN4iK.
lebedev.ri added a project: LLVM.
Herald added a subscriber: hiraditya.

While `-div-rem-pairs` pass can decompose rem in div+rem pair when div-rem pair
is unsupported by target, nothing performs the opposite fold.
We can't do that in InstCombine or DAGCombine since neither of those has access to TTI.
So it makes most sense to teach `-div-rem-pairs` about it.

If we matched rem in expanded form, we know we will be able to place div-rem pair
next to each other so we won't regress the situation.
Also, we shouldn't decompose rem if we matched already-decomposed form.
This is surprisingly straight-forward otherwise.

https://bugs.llvm.org/show_bug.cgi?id=42673


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D65298

Files:
  llvm/include/llvm/Transforms/Utils/BypassSlowDivision.h
  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: D65298.211810.patch
Type: text/x-patch
Size: 10367 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190725/3357200a/attachment.bin>


More information about the llvm-commits mailing list