[llvm] [InstCombine] Canonicalize (a + 1 == 0) ? -1 : a + 1 -> uadd.sat(a, 1) (PR #144566)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 17 12:24:18 PDT 2025
AZero13 wrote:
> I don't think this is the right place to fix this. We need to rewrite
>
> ```
> %add = add i32 %num, 1
> %cmp = icmp eq i32 %add, 0
> ```
>
> to
>
> ```
> %cmp = icmp eq i32 %num, -1
> ```
>
> Then the rest just works.
unsigned square2eer(unsigned a) {
return a + 7 == 7;
}
folds fine, but when we have multiple uses, it is not simplifying because it is reusing the a + 7
https://github.com/llvm/llvm-project/pull/144566
More information about the llvm-commits
mailing list