OSDN Git Service

[InstCombine] use similar ops for related folds; NFCI
authorSanjay Patel <spatel@rotateright.com>
Thu, 13 Apr 2017 17:36:24 +0000 (17:36 +0000)
committerSanjay Patel <spatel@rotateright.com>
Thu, 13 Apr 2017 17:36:24 +0000 (17:36 +0000)
commitc1e5fd3c421c2da97ea37a7e2680951dff2fa9e5
treeff70603f0c5531997966bfb2dc2f11bd70134a9c
parent104e2fb761dae7a9ae78b7549674811b2139181b
[InstCombine] use similar ops for related folds; NFCI

It's less efficient to produce 'ule' than 'ult' since we know we're going to
canonicalize to 'ult', but we shouldn't have duplicated code for these folds.

As a trade-off, this was a pretty terrible way to make a '2'. :)
       if (LHSC == SubOne(RHSC))
         AddC = ConstantExpr::getSub(AddOne(RHSC), LHSC);

The next steps are to share the code to fix PR32524 and add the missing 'and'
fold that was left out when PR14708 was fixed:
https://bugs.llvm.org/show_bug.cgi?id=14708

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300222 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/InstCombine/InstCombineAndOrXor.cpp