Should not constant fold insertelement instruction for scalable vector type.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
current upstream crash with "void llvm::Value::doRAUW(llvm::Value *, llvm::Value::ReplaceMetadataUses): Assertion `New->getType() == getType() && "replaceAllUses of value with new value of different type!"' failed."
opt -S -instcombine test.ll
test.ll
define <vscale x 4 x i32> @f(i32 %val) { %i = insertelement <vscale x 4 x i32> undef, i32 1, i32 0 ret <vscale x 4 x i32> %i }
instcombine probably isn't the best place to stick a test for ConstantFold.cpp. Not sure where we're sticking tests for ConstantFold.cpp these days, though. Maybe test/Analysis/ConstantFolding/ is appropriate. (The directory name is actually referring to different code, but it's closer.)
llvm/lib/IR/ConstantFold.cpp | ||
---|---|---|
840 | We could handle the special case of inserting zero into a zero vector. Not important, though. | |
llvm/test/Transforms/InstCombine/insertelement.ll | ||
71 | Tests involving non-constant operands don't really seem related. |
LGTM. But please wait a couple days before you merge in case anyone wants to comment on the API usage.
It would be clearer to say: