[PATCH] D65765: [InstCombine] Non-canonical clamp-like pattern handling

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 13 08:31:47 PDT 2019


lebedev.ri added a comment.

In D65765#1627080 <https://reviews.llvm.org/D65765#1627080>, @lebedev.ri wrote:

> Hm, two more things for future consideration here:
>
> 1. `matchClamp()` in `ValueTracking.cpp` requires the constant in `icmp` and in `select` to match, yet the fold to ensure that is **intentionally** scalar-only: https://godbolt.org/z/3lorhB vs https://godbolt.org/z/_XN2yO
> 2. The pattern we produce here isn't *really* a clamp, both comparisons are of the same original value; we may want to pull the comparison for the second `select` through the first `select`, but we will only be able to do that if we know that it won't change the result of that comparison (i.e. the replacement value in innermost `select` needs to be `select`, too)


Err, the first issue is actually caused by the second one.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65765/new/

https://reviews.llvm.org/D65765





More information about the llvm-commits mailing list