[llvm] [InstCombine] Fold `sext(trunc nsw)` and `zext(trunc nuw)` (PR #88609)

via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 13 11:29:53 PDT 2024


YanWQ-monad wrote:

This fold unfortunately causes information loss, which may hinder other folds.

For example, `Y = zext (trunc nuw i8 X to i1) to i8` would be folded to `Y = X`, but the information that `Y` ranges in `[0, 1]` is lost. This loss might be hard to recover, unless we could retrieval it from `X`.

For the above reason, I am not sure if this fold is worth a try.

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


More information about the llvm-commits mailing list