[PATCH] D37713: [InstSimplify] fold sdiv/srem based on compare of dividend and divisor

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 11 14:22:55 PDT 2017


spatel created this revision.
Herald added a subscriber: mcrosier.

This should bring signed div/rem analysis up to the same level as unsigned. We use icmp simplification to determine when the divisor is known greater than the dividend.

It's possible I've been staring at this too long and made it more complicated than necessary.

Here are attempts to prove correctness in Alive:
http://rise4fun.com/Alive/TRQp
http://rise4fun.com/Alive/DMs

Each positive test is followed by a negative test to show that we're not overstepping the boundaries of the known bits.


https://reviews.llvm.org/D37713

Files:
  lib/Analysis/InstructionSimplify.cpp
  test/Transforms/InstCombine/div.ll
  test/Transforms/InstSimplify/signed-div-rem.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37713.114686.patch
Type: text/x-patch
Size: 10021 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170911/5155bcc9/attachment.bin>


More information about the llvm-commits mailing list