[PATCH] D132888: [InstCombine] reduce test-for-overflow of shifted value

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 3 05:50:12 PDT 2022


spatel added inline comments.


================
Comment at: llvm/test/Transforms/InstCombine/icmp-shl-1-overflow.ll:117
 ;
-  %x = add <2 x i8> <i8 42, i8 42>, %_x ; thwart complexity-based canonicalization
+  %x = sdiv <2 x i8> <i8 42, i8 42>, %_x ; thwart complexity-based canonicalization
   %add = shl <2 x i8> %x, <i8 1, i8 1>
----------------
spatel wrote:
> spatel wrote:
> > You changed this test (and one below) because there's a follow-on transform that would fold the add into the equality comparison?
> > It's fine to demonstrate a sequence of transforms as long as we're starting from the transform in this patch.
> > 
> > In fact, this result shows that we missed another optimization - the result is 0 when the input is signed >  42 or signed < -42, and that can be reduced to:
> > https://alive2.llvm.org/ce/z/erdvwc
> > 
> Filed that here:
> https://github.com/llvm/llvm-project/issues/57338
Oops - copied the wrong link. Should be:
https://github.com/llvm/llvm-project/issues/57542


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

https://reviews.llvm.org/D132888



More information about the llvm-commits mailing list