[Codegen] TargetLowering::SimplifySetCC(): omit urem when possible
authorRoman Lebedev <lebedev.ri@gmail.com>
Tue, 25 Jun 2019 10:01:42 +0000 (10:01 +0000)
committerRoman Lebedev <lebedev.ri@gmail.com>
Tue, 25 Jun 2019 10:01:42 +0000 (10:01 +0000)
commitcdd43eac4fe3a4fbfca30d95d2032c23b3bf838d
tree379d9f4564b50e22df9b7e786947b9adb1778dbb
parent0142b9ce318ab94295d7fe4764eadaeab84cacb5
[Codegen] TargetLowering::SimplifySetCC(): omit urem when possible

Summary:
This addresses the regression that is being exposed by D50222 in `test/CodeGen/X86/jump_sign.ll`
The missing fold, at least partially, looks trivial:
https://rise4fun.com/Alive/Zsln
i.e. if we are comparing with zero, and comparing the `urem`-by-non-power-of-two,
and the `urem` is of something that may at most have a single bit set (or no bits set at all),
the `urem` is not needed.

Reviewers: RKSimon, craig.topper, xbolva00, spatel

Reviewed By: xbolva00, spatel

Subscribers: xbolva00, llvm-commits

Tags: #llvm

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

llvm-svn: 364286
llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
llvm/test/CodeGen/X86/omit-urem-of-power-of-two-or-zero-when-comparing-with-zero.ll