[InstCombine] Combine no-wrap sub and icmp w/ constant.
authorLuqman Aden <me@luqman.ca>
Thu, 4 Apr 2019 07:08:30 +0000 (07:08 +0000)
committerLuqman Aden <me@luqman.ca>
Thu, 4 Apr 2019 07:08:30 +0000 (07:08 +0000)
commit8911c5be46b9ae1235944dee4d2f7e89a12b9fca
treea2b015cd222639c1580da821c944c7fb5a52ef3a
parent3649c20884f2c78fac0e1b7479a7054a2e002dd0
[InstCombine] Combine no-wrap sub and icmp w/ constant.

Teach InstCombine the transformation `(icmp P (sub nuw|nsw C2, Y), C) -> (icmp swap(P) Y, C2-C)`

Reviewers: majnemer, apilipenko, sanjoy, spatel, lebedev.ri

Reviewed By: lebedev.ri

Subscribers: dmgreen, lebedev.ri, nikic, hiraditya, JDevlieghere, jfb, jdoerfert, llvm-commits

Tags: #llvm

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

llvm-svn: 357674
llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
llvm/test/Transforms/InstCombine/icmp-sub.ll