[PATCH] D97397: [InstCombine] Add a combine for a shuffle of identical bitcasts
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 24 09:46:59 PST 2021
lebedev.ri added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp:2299
+ X->getType()->isVectorTy() &&
+ cast<FixedVectorType>(X->getType())->getNumElements() == VWidth &&
+ X->getType() == Y->getType()) {
----------------
sanwou01 wrote:
> lebedev.ri wrote:
> > Can we do anything for the case where we have element count mismatches?
> Yes, I'm being fairly conservative here. I think the following example would be legal to transform similarly. Is that what you had in mind?
>
> ```
> %0 = bitcast <4 x i32> %a to <4 x float>
> %1 = bitcast <2 x i32> %b to <2 x float>
> %2 = shufflevector <4 x float> %0, <2 x float> %1, <2 x i32> <i32 3, i32 5>
> ```
I actually don't have anything particular in mind, just asking.
That being said, i think both operands of a `shufflevector` must have the same type
(including vector element count), so i'm not sure that example works?
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