[llvm] [SLP] Match poison as instruction with the same opcode (PR #115946)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 19 09:04:33 PST 2024


================
@@ -893,18 +896,27 @@ static bool isCmpSameOrSwapped(const CmpInst *BaseCI, const CmpInst *CI,
 static InstructionsState getSameOpcode(ArrayRef<Value *> VL,
                                        const TargetLibraryInfo &TLI) {
   // Make sure these are all Instructions.
-  if (!all_of(VL, IsaPred<Instruction>))
+  if (!all_of(VL, IsaPred<Instruction, PoisonValue>))
+    return InstructionsState::invalid();
+
+  auto *It = find_if(VL, IsaPred<Instruction>);
+  if (It == VL.end())
+    return InstructionsState::invalid();
----------------
RKSimon wrote:

can this realistically happen given the all_of check above? replace with assert?

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


More information about the llvm-commits mailing list