[PATCH] D151068: [Scalarizer] Fix for vector bitcasts of different element numbers
Mikael Holmén via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 22 02:05:39 PDT 2023
uabelho created this revision.
uabelho added reviewers: nhaehnle, foad, fhahn.
Herald added subscribers: StephenFan, bjope, hiraditya.
Herald added a project: All.
uabelho requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
[Scalarizer] Fix for vector bitcasts of different element numbers
When scalarizing bitcasts ScalarizerVisitor::visitBitCastInst divide the
input in three different cases:
1. same number of elements before and after
2. more elements after
3. less elements after
For the first case there is no problem, but for 2) the code only really
worked if we had the case
<M x t1> -> <N*M x t2>
Similarly for 3), the code only made sense for
<N*M x t1> -> <M x t2>
So e.g. if we get a bitcast like
%bc94 = bitcast <6 x i64> %wide.vec to <8 x i48>, !dbg !157
ScalarizerVisitor::visitBitCastInst crashes with
opt: ../lib/IR/Instructions.cpp:3447: static llvm::CastInst *llvm::CastInst::Create(Instruction::CastOps, llvm::Value *, llvm::Type *, const llvm::Twine &, llvm::Instruction *): Assertion `castIsValid(op, S, Ty) && "Invalid cast!"' failed.
With this patch, we now make the scalarizer just leave such a bitcast since
it's totally unclear what we should do with it anyway.
ScalarizerVisitor::visitBitCastInst already returned early for
non-FixedVectorType type vectors.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D151068
Files:
llvm/lib/Transforms/Scalar/Scalarizer.cpp
llvm/test/Transforms/Scalarizer/bitcast.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151068.524192.patch
Type: text/x-patch
Size: 5721 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230522/d0453c47/attachment.bin>
More information about the llvm-commits
mailing list