[llvm] [X86] Fix failure to lower i8/i16 bzhi pattern to bzhi (PR #226401)

via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 25 02:32:44 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/Target/X86/X86ISelDAGToDAG.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/Target/X86/X86ISelDAGToDAG.cpp b/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
index 75dd37d52..fe3fc3e0d 100644
--- a/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
+++ b/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
@@ -4250,9 +4250,8 @@ bool X86DAGToDAGISel::matchBitExtract(SDNode *Node) {
 
   // Try to match potentially-truncated shift amount as `(bitwidth - y)`,
   // or leave the shift amount as-is, but then we'll have to negate it.
-  auto canonicalizeShiftAmt = [&NBits, &NegateNBits,
-                               &MatchedBitwidth](SDValue ShiftAmt,
-                                                 unsigned Bitwidth) {
+  auto canonicalizeShiftAmt = [&NBits, &NegateNBits, &MatchedBitwidth](
+                                  SDValue ShiftAmt, unsigned Bitwidth) {
     MatchedBitwidth = Bitwidth;
     NBits = ShiftAmt;
     NegateNBits = true;
@@ -4413,8 +4412,7 @@ bool X86DAGToDAGISel::matchBitExtract(SDNode *Node) {
   // We might have matched the amount of high bits to be cleared,
   // but we want the amount of low bits to be kept, so negate it then.
   if (NegateNBits) {
-    SDValue BitWidthC =
-        CurDAG->getConstant(MatchedBitwidth, DL, MVT::i32);
+    SDValue BitWidthC = CurDAG->getConstant(MatchedBitwidth, DL, MVT::i32);
     insertDAGNode(*CurDAG, SDValue(Node, 0), BitWidthC);
 
     NBits = CurDAG->getNode(ISD::SUB, DL, MVT::i32, BitWidthC, NBits);

``````````

</details>


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


More information about the llvm-commits mailing list