[PATCH] D126056: [InstCombine] [NFC] Move transforms for truncated shifts into narrowBinOp

Chenbing.Zheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 24 19:28:27 PDT 2022


Chenbing.Zheng added a comment.

In D126056#3534059 <https://reviews.llvm.org/D126056#3534059>, @spatel wrote:

> LGTM - but please add a test to verify that we do not create a bug with `shl`.
>
> I think this would have miscompiled with the previous revision of the patch:
>
>   define <2 x i8> @trunc_lshr_trunc(<2 x i64> %a) {
>     %b = trunc <2 x i64> %a to <2 x i32>
>     %c = shl <2 x i32> %b, <i32 9, i32 7>
>     %d = trunc <2 x i32> %c to <2 x i8>
>     ret <2 x i8> %d
>   }

I commit it in https://reviews.llvm.org/rG793bb7049db012df4fe3ff6e8abc320677845400,and it pass after this patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D126056



More information about the llvm-commits mailing list