[llvm] [InstCombine] isKnownNonNegative should recognize `b - a` after `a <= b` (PR #145105)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 21 09:16:36 PDT 2025


dtcxzyw wrote:

The net effect looks good. But this patch converts more sexts into `zext nneg`, resulting in less elimination of cast instructions. This regression can be fixed by widening the whole expression tree with `canEvaluateSExtd/EvaluateInDifferentType`, as we did for sext: https://github.com/llvm/llvm-project/blob/463ce0131047457fdd320c852f187fd70532de9a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp#L1500-L1519


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


More information about the llvm-commits mailing list