[llvm] [InstCombine] Fold `(icmp pred (trunc nuw/nsw X), C)` -> `(icmp pred X, (zext/sext C))` (PR #87935)

via llvm-commits llvm-commits at lists.llvm.org
Sat May 11 08:57:53 PDT 2024


goldsteinn wrote:

> > There are some regressions. But I don't think we should block this patch.
> 
> What would likely avoid regressions would be to limit this to one-use truncs. I assume that the main problem is that it's hard to infer facts about the truncated value after conditions have been changed to use the non-truncated value.

NB, part of this is canonicalization imo. Original motivation was if we should extend the trunc handling in `computeKnownBitsFromICmpCond`

https://github.com/llvm/llvm-project/pull/87935


More information about the llvm-commits mailing list