[clang] [llvm] [InstCombine] Infer nsw/nuw for trunc (PR #87910)

via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 7 12:05:28 PDT 2024


goldsteinn wrote:

Not an issue now but I think we should look into updating `computeKnownBitsFromContext` to look use `trunc nsw/nuw` uses of `X`. If the use is dominating / noundef, we can infer bits about `X`.
Not really an issue if we only use `KnownBits` to infer `nuw`/`nsw`, but once we add support in `SCEV`/`CVP`/`SCCP`/etc.. it may be useful.

Guess same is true for `zext nneg` now (and could probably also do `sub nuw X, nonzero_Y` now in `isKnownNonNullFromDominatingCondition`).

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


More information about the llvm-commits mailing list