]> granicus.if.org Git - llvm/commit
[InstCombine] matchThreeWayIntCompare(): commutativity awareness
authorRoman Lebedev <lebedev.ri@gmail.com>
Sat, 24 Aug 2019 06:49:36 +0000 (06:49 +0000)
committerRoman Lebedev <lebedev.ri@gmail.com>
Sat, 24 Aug 2019 06:49:36 +0000 (06:49 +0000)
commit17bb71c533efd6783e0b47581796e99e85178d6f
tree0e374c257442853d1044c2b007b18ac4616448ab
parent2f0aeb5b363cc9f0d12d93259c7541736246ba0a
[InstCombine] matchThreeWayIntCompare(): commutativity awareness

Summary:
`matchThreeWayIntCompare()` looks for
```
   select i1 (a == b),
          i32 Equal,
          i32 (select i1 (a < b), i32 Less, i32 Greater)
```
but both of these selects/compares can be in it's commuted form,
so out of 8 variants, only the two most basic ones is handled.
This fixes regression being introduced in D66232.

Reviewers: spatel, nikic, efriedma, xbolva00

Reviewed By: spatel

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369841 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/InstCombine/InstCombineCompares.cpp
test/Transforms/InstCombine/unrecognized_three-way-comparison.ll