[AMDGPU] mul
used with v1i8 / v1i16 causes crash during IR optimizations due to type mismatch
#58331
Labels
mul
used with v1i8 / v1i16 causes crash during IR optimizations due to type mismatch
#58331
Description
For
amdgcn
, whenmul
is used withv1i8
/v1i16
causes crash during IR optimizations due to type mismatch.The problem doesn't exist for
v1i32
.Cause
In function
AMDGPUCodeGenPrepare::replaceMulWithMul24
,llvm-project/llvm/lib/Target/AMDGPU/AMDGPUCodeGenPrepare.cpp
Lines 570 to 573 in 12c6a41
insertValues
will turn a vector of size 1 into a scalar due to the following logic:llvm-project/llvm/lib/Target/AMDGPU/AMDGPUCodeGenPrepare.cpp
Lines 468 to 472 in 12c6a41
As a result, when
replaceAllUsesWith
is called, the assertionNew->getType() == getType() && "replaceAllUses of value with new value of different type!"
failed because the old type (vector) and the new type (scaler) are not the same.Minimal Reproduction
https://godbolt.org/z/48n93sTWf
Code
Stack Trace
The text was updated successfully, but these errors were encountered: