1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-18 18:42:46 +02:00

[mlir][Standard] Add a canonicalization to simplify cond_br when the successors are identical

This revision adds support for canonicalizing the following:

```
cond_br %cond, ^bb1(A, ..., N), ^bb1(A, ..., N)

br ^bb1(A, ..., N)
```

 If the operands to the successor are different and the cond_br is the only predecessor, we emit selects for the branch operands.

```
cond_br %cond, ^bb1(A), ^bb1(B)

%select = select %cond, A, B
br ^bb1(%select)
```

Differential Revision: https://reviews.llvm.org/D78682
This commit is contained in:
River Riddle 2020-04-23 04:40:25 -07:00
parent 355bc17b08
commit ba1b761ce1

View File

@ -1123,10 +1123,13 @@ public:
}
/// Compare this range with another.
template <typename OtherT> bool operator==(const OtherT &other) {
template <typename OtherT> bool operator==(const OtherT &other) const {
return size() == std::distance(other.begin(), other.end()) &&
std::equal(begin(), end(), other.begin());
}
template <typename OtherT> bool operator!=(const OtherT &other) const {
return !(*this == other);
}
/// Return the size of this range.
size_t size() const { return count; }