[llvm] [llvm][SLPVectorizer] Fix a bad cast assertion (PR #97621)

Yingchi Long via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 3 15:59:41 PDT 2024


================
@@ -361,12 +361,14 @@ static bool isCommutative(Instruction *I) {
   return I->isCommutative();
 }
 
-/// \returns inserting index of InsertElement or InsertValue instruction,
-/// using Offset as base offset for index.
-static std::optional<unsigned> getInsertIndex(const Value *InsertInst,
-                                              unsigned Offset = 0) {
+template <typename T>
+static std::optional<unsigned> getInsertExtractIndex(const Value *Inst,
----------------
inclyc wrote:

```suggestion
std::optional<unsigned> getInsertExtractIndex(const Value *Inst,
```

A little strange with that `static`, maybe better declares all these helpers in anonymous namespace?

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


More information about the llvm-commits mailing list