[llvm] [llvm][SLPVectorizer] Fix a bad cast assertion rdar://128092379 (PR #97621)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 3 12:15:43 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff c0d1d0405cb9f55ec12dfb0cec9c5639d3b357d8 f054211ff11b623e197ed662f81987111cb10129 -- llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index 485873f9d2..50e9b9669b 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -12805,15 +12805,15 @@ Value *BoUpSLP::vectorizeTree(TreeEntry *E, bool PostponedPHIs) {
           // sequence.
           InsertElementInst *Ins = cast<InsertElementInst>(VL0);
           do {
-          std::optional<unsigned> InsertIdx = getElementIndex(Ins);
-          if (!InsertIdx)
-            break;
-          if (InsertMask[*InsertIdx] == PoisonMaskElem)
-            InsertMask[*InsertIdx] = *InsertIdx;
-          if (!Ins->hasOneUse())
-            break;
-          Ins = dyn_cast_or_null<InsertElementInst>(
-              Ins->getUniqueUndroppableUser());
+            std::optional<unsigned> InsertIdx = getElementIndex(Ins);
+            if (!InsertIdx)
+              break;
+            if (InsertMask[*InsertIdx] == PoisonMaskElem)
+              InsertMask[*InsertIdx] = *InsertIdx;
+            if (!Ins->hasOneUse())
+              break;
+            Ins = dyn_cast_or_null<InsertElementInst>(
+                Ins->getUniqueUndroppableUser());
           } while (Ins);
           SmallBitVector UseMask =
               buildUseMask(NumElts, InsertMask, UseMask::UndefsAsMask);

``````````

</details>


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


More information about the llvm-commits mailing list