[PATCH] D50222: [CodeGen] [SelectionDAG] More efficient code for X % C == 0 (UREM case)

Dmytro Shynkevych via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 29 18:32:58 PDT 2018


hermord updated this revision to Diff 163245.
hermord retitled this revision from "[CodeGen] [SelectionDAG] More efficient code for X % C == 0" to "[CodeGen] [SelectionDAG] More efficient code for X % C == 0 (UREM case)".
hermord added a comment.
Herald added a reviewer: javed.absar.

Thank you for the review, @lebedev.ri, addressed:

  - Added `isIntDivCheap` as an additional condition preventing this optimization. If this isn't customizable enough, we could probably do something like `if (isIntDivCheap || (minsize && isIntDivShort))` where `isIntDivShort` can be overriden per-target.
- I'm not an LLVM developer; as far as I understand, I can't commit anything
- Added tests for AArch64
- Removed the signed bits

`CodeGen/X86/jump_sign.ll` still isn't passing; I've been trying different things, but none seem to make for a satisying fix (if I introduce the optimizaion in `InstCombine`, I'll still have to change the test to pipe through `opt`, which I'm not sure is better than just chaning the test to match current output). On a related note, after looking at it, should this entire thing be in `InstCombine`, actually?


Repository:
  rL LLVM

https://reviews.llvm.org/D50222

Files:
  include/llvm/CodeGen/TargetLowering.h
  lib/CodeGen/SelectionDAG/TargetLowering.cpp
  test/CodeGen/AArch64/urem-seteq-optsize.ll
  test/CodeGen/AArch64/urem-seteq.ll
  test/CodeGen/X86/jump_sign.ll
  test/CodeGen/X86/urem-seteq-optsize.ll
  test/CodeGen/X86/urem-seteq.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50222.163245.patch
Type: text/x-patch
Size: 19354 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180830/478154dc/attachment.bin>


More information about the llvm-commits mailing list