aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
diff options
context:
space:
mode:
authorRobert Lougher <rob.lougher@gmail.com>2019-05-07 19:36:41 +0000
committerRobert Lougher <rob.lougher@gmail.com>2019-05-07 19:36:41 +0000
commit8681ef8f41db61586fdc4d252a1ea89e0958ce46 (patch)
tree781d7e43bfe06b7531a8c27c30eda6f8e37d92fa /llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
parent4727221734403b86d5bb6385fee7e7fec6fa52ff (diff)
downloadllvm-8681ef8f41db61586fdc4d252a1ea89e0958ce46.zip
llvm-8681ef8f41db61586fdc4d252a1ea89e0958ce46.tar.gz
llvm-8681ef8f41db61586fdc4d252a1ea89e0958ce46.tar.bz2
[InstCombine] Add new combine to add folding
(X | C1) + C2 --> (X | C1) ^ C1 iff (C1 == -C2) I verified the correctness using Alive: https://rise4fun.com/Alive/YNV This transform enables the following transform that already exists in instcombine: (X | Y) ^ Y --> X & ~Y As a result, the full expected transform is: (X | C1) + C2 --> X & ~C1 iff (C1 == -C2) There already exists the transform in the sub case: (X | Y) - Y --> X & ~Y However this does not trigger in the case where Y is constant due to an earlier transform: X - (-C) --> X + C With this new add fold, both the add and sub constant cases are handled. Patch by Chris Dawson. Differential Revision: https://reviews.llvm.org/D61517 llvm-svn: 360185
Diffstat (limited to 'llvm/lib/Transforms/Utils/BasicBlockUtils.cpp')
0 files changed, 0 insertions, 0 deletions