[llvm] [SelectionDAG] Avoid unsafe scalarization of widened extract binops (PR #221165)

via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 4 01:09:04 PDT 2026


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 origin/main HEAD --extensions cpp -- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

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

``````````diff
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index c6e08fbf9..bad126953 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -25612,12 +25612,10 @@ static SDValue scalarizeExtractedBinOp(SDNode *ExtElt, SelectionDAG &DAG,
   // EXTRACT_VECTOR_ELT may return an integer type wider than the vector element
   // type, with undefined high bits. Only scalarize binops in that widened type
   // if their low bits cannot depend on those undefined high bits.
-  if (ResVT != EltVT &&
-      !isBinOpLowBitsInvariantWithWidenedOperands(Opc))
+  if (ResVT != EltVT && !isBinOpLowBitsInvariantWithWidenedOperands(Opc))
     return SDValue();
 
-  if (Opc == ISD::SETCC &&
-      (ResVT != EltVT || LegalTypes))
+  if (Opc == ISD::SETCC && (ResVT != EltVT || LegalTypes))
     return SDValue();
 
   // Extracting an element of a vector constant is constant-folded, so this

``````````

</details>


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


More information about the llvm-commits mailing list