[PATCH] D29053: [InstSimplify] try to eliminate icmp Pred (add nsw X, C1), C2

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 23 15:09:58 PST 2017


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

I was surprised to see that we're missing icmp folds based on 'add nsw' in InstCombine, but I think we should handle the 'InstSimplify' cases first because that could make the InstCombine code simpler.

Here's an attempt to prove the logic with Alive:
http://rise4fun.com/Alive/g5Q

gcc has had these kinds of folds since at least v4.4 based on:
https://godbolt.org/g/J1nh5Q


https://reviews.llvm.org/D29053

Files:
  lib/Analysis/InstructionSimplify.cpp
  test/Transforms/InstSimplify/icmp-constant.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29053.85460.patch
Type: text/x-patch
Size: 4035 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170123/74e26019/attachment.bin>


More information about the llvm-commits mailing list