Skip to content

Commit b604d23

Browse files
committed
[VectorCombine] Pull out isa<VectorType> check.
Noticed while investigating a crash in #119559 - we don't account for I being replaced and its Type being reallocated. So hoist the checks to the start of the loop.
1 parent 5b07750 commit b604d23

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

llvm/lib/Transforms/Vectorize/VectorCombine.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2873,6 +2873,7 @@ bool VectorCombine::run() {
28732873
bool MadeChange = false;
28742874
auto FoldInst = [this, &MadeChange](Instruction &I) {
28752875
Builder.SetInsertPoint(&I);
2876+
bool IsVectorType = isa<VectorType>(I.getType());
28762877
bool IsFixedVectorType = isa<FixedVectorType>(I.getType());
28772878
auto Opcode = I.getOpcode();
28782879

@@ -2895,7 +2896,7 @@ bool VectorCombine::run() {
28952896

28962897
// This transform works with scalable and fixed vectors
28972898
// TODO: Identify and allow other scalable transforms
2898-
if (isa<VectorType>(I.getType())) {
2899+
if (IsVectorType) {
28992900
MadeChange |= scalarizeBinopOrCmp(I);
29002901
MadeChange |= scalarizeLoadExtract(I);
29012902
MadeChange |= scalarizeVPIntrinsic(I);

0 commit comments

Comments
 (0)