[llvm] [InstCombine] Fold `sext(trunc nsw)` and `zext(trunc nuw)` (PR #88609)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Apr 14 17:57:01 PDT 2024
goldsteinn 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.
maybe the right place is DAGCombiner then.
https://github.com/llvm/llvm-project/pull/88609
More information about the llvm-commits
mailing list