]> granicus.if.org Git - llvm/commit
[InstCombine] (Y + ~X) + 1 --> Y - X fold (PR42459)
authorRoman Lebedev <lebedev.ri@gmail.com>
Mon, 1 Jul 2019 15:55:24 +0000 (15:55 +0000)
committerRoman Lebedev <lebedev.ri@gmail.com>
Mon, 1 Jul 2019 15:55:24 +0000 (15:55 +0000)
commit5b80637fd33a726d813623cf0ed2aeba10893ee1
tree9234d119917eb985457815feecac9e89a63103c7
parent458204d46507d4613d9536aa2f06293bd1f13943
[InstCombine] (Y + ~X) + 1 --> Y - X  fold (PR42459)

Summary:
To be noted, this pattern is not unhandled by instcombine per-se,
it is somehow does end up being folded when one runs opt -O3,
but not if it's just -instcombine. Regardless, that fold is
indirect, depends on some other folds, and is thus blind
when there are extra uses.

This does address the regression being exposed in D63992.

https://godbolt.org/z/7DGltU
https://rise4fun.com/Alive/EPO0

Fixes [[ https://bugs.llvm.org/show_bug.cgi?id=42459 | PR42459 ]]

Reviewers: spatel, nikic, huihuiz

Reviewed By: spatel

Subscribers: llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364792 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/InstCombine/InstCombineAddSub.cpp
test/Transforms/InstCombine/add.ll
test/Transforms/InstCombine/fold-inc-of-add-of-not-x-and-y-to-sub-x-from-y.ll