[PATCH] D67334: [InstCombine] fold sign-bit compares of srem

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 8 14:00:50 PDT 2019


spatel created this revision.
spatel added reviewers: lebedev.ri, nikic, RKSimon.
Herald added subscribers: hiraditya, mcrosier.
Herald added a project: LLVM.

(srem X, pow2C) sgt/slt 0 can be reduced using bit hacks as shown:
https://rise4fun.com/Alive/jSO
A '2' divisor allows slightly more folding:
https://rise4fun.com/Alive/tDBM

Any chance to remove an 'srem' use is probably worthwhile, but I've kept this to the strict improvement case because it may expose other missing folds. That means it does nothing for PR21929 yet:
https://bugs.llvm.org/show_bug.cgi?id=21929


https://reviews.llvm.org/D67334

Files:
  llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
  llvm/lib/Transforms/InstCombine/InstCombineInternal.h
  llvm/test/Transforms/InstCombine/icmp-div-constant.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67334.219277.patch
Type: text/x-patch
Size: 6066 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190908/d0d2ffba/attachment.bin>


More information about the llvm-commits mailing list