[llvm] [SLP] NFC. Use InstructionsState::valid if users just want to know whether VL has same opcode. (PR #120217)

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 26 11:16:22 PST 2024


================
@@ -8144,9 +8147,8 @@ void BoUpSLP::buildTree_rec(ArrayRef<Value *> VL, unsigned Depth,
   }
 
   // Don't handle scalable vectors
-  if (S.getOpcode() == Instruction::ExtractElement &&
-      isa<ScalableVectorType>(
-          cast<ExtractElementInst>(S.getMainOp())->getVectorOperandType())) {
+  if (auto *EE = dyn_cast_if_present<ExtractElementInst>(S.getMainOp());
----------------
alexey-bataev wrote:

It won't work, it will crash the compiler, `_and_present` are not required

https://github.com/llvm/llvm-project/pull/120217


More information about the llvm-commits mailing list