[PATCH] D143373: [InstCombine] fold icmp of the sum of ext bool based on limited range

chenglin.bi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 13 18:22:28 PST 2023


bcl5980 added a comment.

In D143373#4122975 <https://reviews.llvm.org/D143373#4122975>, @spatel wrote:

> In D143373#4121737 <https://reviews.llvm.org/D143373#4121737>, @bcl5980 wrote:
>
>> remove the condition CmpC->abs().ule(1)
>
> Without that condition, we can't use getSextValue() safely on the compare constant. This test needs to be added (please pre-commit the new tests too) because it will now crash:
>
>   define i1 @zext_sext_add_icmp_sgt_minus2(i1 %a, i1 %b) {
>     %zext.a = zext i1 %a to i128
>     %sext.b = sext i1 %b to i128
>     %add = add i128 %zext.a, %sext.b
>     %r = icmp sgt i128 %add, 9223372036854775808
>     ret i1 %r
>   }

Thanks for the catch!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D143373/new/

https://reviews.llvm.org/D143373



More information about the llvm-commits mailing list