X86: Fix VSCALE insert element crash in codegen (#177705)
When inserting elements into <vscale x N x i64> scalable vectors, the X86 backend now returns InstructionCost::getInvalid() instead of panicking. Fixes #176823
This commit is contained in:
parent
0263baa0b5
commit
2deae0baf7
@ -4815,6 +4815,10 @@ InstructionCost X86TTIImpl::getVectorInstrCost(unsigned Opcode, Type *Val,
|
||||
};
|
||||
|
||||
assert(Val->isVectorTy() && "This must be a vector type");
|
||||
auto *VT = cast<VectorType>(Val);
|
||||
if (VT->isScalableTy())
|
||||
return InstructionCost::getInvalid();
|
||||
|
||||
Type *ScalarType = Val->getScalarType();
|
||||
InstructionCost RegisterFileMoveCost = 0;
|
||||
|
||||
|
||||
@ -0,0 +1,10 @@
|
||||
; RUN: opt -passes=print<cost-model> -disable-output < %s
|
||||
; This test triggers a crash in X86 TTI with scalable vectors
|
||||
|
||||
target triple = "x86_64-unknown-linux-gnu"
|
||||
|
||||
define <vscale x 1 x i64> @test(i64 %x) {
|
||||
entry:
|
||||
%v = insertelement <vscale x 1 x i64> poison, i64 %x, i64 0
|
||||
ret <vscale x 1 x i64> %v
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user