HomePhabricator

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

Authored by lebedev.ri on Jul 30 2019, 12:10 AM.

Description

[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

llvm-svn: 367288

Details

Committed
lebedev.riJul 30 2019, 12:10 AM
Reviewer
bogner
Differential Revision
D65298: [DivRemPairs] Handling for expanded-form rem - recomposition (PR42673)
Parents
rG6606815993b6: [APInt] Introduce clearLowBits()
Branches
Unknown
Tags
Unknown