[llvm] b604d23 - [VectorCombine] Pull out isa<VectorType> check.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 12 03:02:24 PST 2024
Author: Simon Pilgrim
Date: 2024-12-12T11:02:01Z
New Revision: b604d23febe9ac25d274fd933044aa7846d4397e
URL: https://github.com/llvm/llvm-project/commit/b604d23febe9ac25d274fd933044aa7846d4397e
DIFF: https://github.com/llvm/llvm-project/commit/b604d23febe9ac25d274fd933044aa7846d4397e.diff
LOG: [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.
Added:
Modified:
llvm/lib/Transforms/Vectorize/VectorCombine.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/VectorCombine.cpp b/llvm/lib/Transforms/Vectorize/VectorCombine.cpp
index 9003642f1f93b2..0dbade544eced0 100644
--- a/llvm/lib/Transforms/Vectorize/VectorCombine.cpp
+++ b/llvm/lib/Transforms/Vectorize/VectorCombine.cpp
@@ -2873,6 +2873,7 @@ bool VectorCombine::run() {
bool MadeChange = false;
auto FoldInst = [this, &MadeChange](Instruction &I) {
Builder.SetInsertPoint(&I);
+ bool IsVectorType = isa<VectorType>(I.getType());
bool IsFixedVectorType = isa<FixedVectorType>(I.getType());
auto Opcode = I.getOpcode();
@@ -2895,7 +2896,7 @@ bool VectorCombine::run() {
// This transform works with scalable and fixed vectors
// TODO: Identify and allow other scalable transforms
- if (isa<VectorType>(I.getType())) {
+ if (IsVectorType) {
MadeChange |= scalarizeBinopOrCmp(I);
MadeChange |= scalarizeLoadExtract(I);
MadeChange |= scalarizeVPIntrinsic(I);
More information about the llvm-commits
mailing list