[InstCombine] sub X, sext(bool Y) -> add X, zext(bool Y)
authorSanjay Patel <spatel@rotateright.com>
Fri, 14 Oct 2016 15:24:31 +0000 (15:24 +0000)
committerSanjay Patel <spatel@rotateright.com>
Fri, 14 Oct 2016 15:24:31 +0000 (15:24 +0000)
commitc6c5965a42284ceafb6d5ca001f6208314a28344
treede59b5c386ece565ee2f66a91c7556489e8e571d
parent3155abfb5753c9045d1560114820f3a8d16be047
[InstCombine] sub X, sext(bool Y) -> add X, zext(bool Y)

Prefer add/zext because they are better supported in terms of value-tracking.

Note that the backend should be prepared for this IR canonicalization
(including vector types) after:
https://reviews.llvm.org/rL284015

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

llvm-svn: 284241
llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
llvm/test/Transforms/InstCombine/sub.ll
llvm/test/Transforms/InstCombine/urem.ll