[PATCH] D97397: [InstCombine] Add a combine for a shuffle of similar bitcasts

Sanne Wouda via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 1 06:32:47 PST 2021


sanwou01 added a comment.

In D97397#2594000 <https://reviews.llvm.org/D97397#2594000>, @lebedev.ri wrote:

> I'd like to see some test improvements:
>
> 1. There are no tests with extra uses on bitcasts
> 2. There are no tests with something like
>
>   %xb = bitcast <2 x half> %x to <2 x i16>
>   %yb = bitcast <2 x bfloat> %y to <2 x i16>
>   %r = shufflevector <2 x i16> %xb, <2 x i16> %yb, <4 x i16> <i16 3, i16 2, i16 1, i16 0>
>
> I suspect this will miscompile?
>
> 3. Some tests have unneeded stuff. They should only contain 2 `bitcast`s and a `shufflevector` (and a `ret`), nothing more.

Thanks for the review, @lebedev.ri !

1. Fair enough, I'll add some tests for that.
2. I'll add this as a test, but I don't think it miscompiles: I do check that the input types of the two bitcasts are identical.
3. Can do. The first two tests were derived from my motivating examples, but I can simplify them some more as you point out, thanks.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97397



More information about the llvm-commits mailing list