[llvm] [PowerPC] Fix handling of undefs in the PPC::isSplatShuffleMask query (PR #145149)

via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 20 21:48:54 PDT 2025


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 HEAD~1 HEAD --extensions cpp -- llvm/lib/Target/PowerPC/PPCISelLowering.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
index d1b17f227..967ebc4cb 100644
--- a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
+++ b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
@@ -2245,12 +2245,12 @@ bool PPC::isSplatShuffleMask(ShuffleVectorSDNode *N, unsigned EltSize) {
     // An UNDEF element is a sequence of UNDEF bits.
     if (N->getMaskElt(i) < 0) {
       for (unsigned j = 1; j != EltSize; ++j)
-        if (N->getMaskElt(i+j) >= 0)
+        if (N->getMaskElt(i + j) >= 0)
+          return false;
+    } else
+      for (unsigned j = 0; j != EltSize; ++j)
+        if (N->getMaskElt(i + j) != N->getMaskElt(j))
           return false;
-    }
-    else for (unsigned j = 0; j != EltSize; ++j)
-      if (N->getMaskElt(i+j) != N->getMaskElt(j))
-        return false;
   }
   return true;
 }

``````````

</details>


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


More information about the llvm-commits mailing list