]> granicus.if.org Git - llvm/commit
[DivRemPairs] Handling for expanded-form rem - recomposition (PR42673)
authorRoman Lebedev <lebedev.ri@gmail.com>
Tue, 30 Jul 2019 07:10:00 +0000 (07:10 +0000)
committerRoman Lebedev <lebedev.ri@gmail.com>
Tue, 30 Jul 2019 07:10:00 +0000 (07:10 +0000)
commit8a2defdd81e99d0f3017b75dad93760f9dbf6a81
tree6f2e2fdf001a8dc54663f98cc3bdee63613b5f8e
parent00170d38eec472cc43eda16a9e3452b3b69b7180
[DivRemPairs] Handling for expanded-form rem - recomposition (PR42673)

Summary:
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

Reviewers: spatel, RKSimon, efriedma, ZaMaZaN4iK, bogner

Reviewed By: bogner

Subscribers: bogner, hiraditya, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367288 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Transforms/Utils/BypassSlowDivision.h
lib/Transforms/Scalar/DivRemPairs.cpp
test/Transforms/DivRemPairs/X86/div-expanded-rem-pair.ll