[llvm] Fix potential crash in SLPVectorizer caused by missing check (PR #95937)

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 25 09:43:15 PDT 2024


================
@@ -835,7 +835,7 @@ static InstructionsState getSameOpcode(ArrayRef<Value *> VL,
         auto *CallBase = cast<CallInst>(IBase);
         if (Call->getCalledFunction() != CallBase->getCalledFunction())
           return InstructionsState(VL[BaseIndex], nullptr, nullptr);
-        if (Call->hasOperandBundles() &&
+        if (Call->hasOperandBundles() && CallBase->hasOperandBundles() &&
----------------
alexey-bataev wrote:

```suggestion
        if (Call->hasOperandBundles() && (!CallBase->hasOperandBundles() ||
```

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


More information about the llvm-commits mailing list