[llvm] [InstCombine] Fold `icmp samesign u{gt/lt} (X +nsw C2), C` -> `icmp s{gt/lt} X, (C - C2)` (PR #169960)
Tirthankar Mazumder via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 4 09:02:53 PST 2025
wermos wrote:
I have handled the `nuw` + `nsw` case in the code now.
I have two questions though:
1. Related to my implementation: I reworked the existing implementation and used a lambda and opted for some amount of code duplication. My reasoning for that was that this would increase code readability. Is this fine, or do we want the code structured a little differently?
2. Related to handling nuw + nsw: You said that "unsigned is the canonical form". Does this extend to predicates too? That is, do we prefer unsigned predicates to signed predicates in this case? If so, I'll have to modify my implementation accordingly, and the diffs in `remove-loop-phi-multiply-by-zero.ll` will go away.
https://github.com/llvm/llvm-project/pull/169960
More information about the llvm-commits
mailing list