[PATCH] D65530: [InstCombine] foldXorOfICmps(): don't give up on non-single-use ICmp's if all users are freely invertible

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 12 09:10:41 PDT 2019


lebedev.ri added a comment.

In D65530#1625321 <https://reviews.llvm.org/D65530#1625321>, @spatel wrote:

> Sorry for the delay in looking at this. What do the motivating examples look like for codegen? Are we getting the optimal codegen for these clamps, or would we better off trying to create min/max and/or saturating intrinsics?


We most certainly do *NOT* get optimal codegen with these patterns, as noted in https://reviews.llvm.org/D65148#1603922 by @dmgreen.
We need to fold them into traditional clamp pattern, D65765 <https://reviews.llvm.org/D65765> does just that.

The motivation behind *this* patch is that out of all the variations of this pattern that we can have (see `canonicalize-clamp-with-select-of-constant-threshold-pattern.ll`),
only this single pattern is not folded into the same form all the other variants are.
So if we don't do this, i will need to redo D65765 <https://reviews.llvm.org/D65765> to do also handle this non-canonical pattern, and i don't think it would be the correct solution.

> ...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65530





More information about the llvm-commits mailing list