[llvm] [DAGCombiner] Refine an extload to a zextload under zext(trunc(...)) (PR #225053)

via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 21 02:52:56 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 0556119f2..dc51e27bf 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -15748,10 +15748,9 @@ static SDValue tryToFoldZExtOfTruncOfExtLoad(SelectionDAG &DAG,
                        Load->getAddressSpace(), ISD::ZEXTLOAD, false))
     return SDValue();
 
-  SDValue ZExtLoad =
-      DAG.getExtLoad(ISD::ZEXTLOAD, SDLoc(Load), Load->getValueType(0),
-                     Load->getChain(), Load->getBasePtr(), MemVT,
-                     Load->getMemOperand());
+  SDValue ZExtLoad = DAG.getExtLoad(
+      ISD::ZEXTLOAD, SDLoc(Load), Load->getValueType(0), Load->getChain(),
+      Load->getBasePtr(), MemVT, Load->getMemOperand());
   // Replace N before retyping the load. getExtLoad may have returned an
   // existing zextload of the same address, in which case replacing the load
   // CSEs the truncate, and N along with it, into pre-existing nodes and
@@ -16513,7 +16512,7 @@ SDValue DAGCombiner::visitZERO_EXTEND(SDNode *N) {
     }
 
     if (SDValue ZExt = tryToFoldZExtOfTruncOfExtLoad(DAG, *this, TLI, VT,
-                                                  LegalOperations, N, N0))
+                                                     LegalOperations, N, N0))
       return ZExt;
 
     EVT SrcVT = N0.getOperand(0).getValueType();

``````````

</details>


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


More information about the llvm-commits mailing list