[llvm] [X86] Fold vpextrq $1 from a spilled vector into a direct memory load (PR #203339)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 11 09:49:37 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/X86InstrInfo.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/X86InstrInfo.cpp b/llvm/lib/Target/X86/X86InstrInfo.cpp
index ac4589041..754cd8a89 100644
--- a/llvm/lib/Target/X86/X86InstrInfo.cpp
+++ b/llvm/lib/Target/X86/X86InstrInfo.cpp
@@ -7438,8 +7438,7 @@ MachineInstr *X86InstrInfo::foldMemoryOperandCustom(
     // Fold: extractelt(v2i64 vector, 1) where vector is a spilled stack slot.
     // Instead of reloading the full vector and extracting with vpextrq, load
     // the upper 8 bytes directly from the spill slot at offset 8.
-    if (OpNum == 1 && MI.getOperand(2).getImm() == 1 &&
-        Alignment >= Align(8)) {
+    if (OpNum == 1 && MI.getOperand(2).getImm() == 1 && Alignment >= Align(8)) {
       MachineInstrBuilder MIB = BuildMI(*InsertPt->getParent(), InsertPt,
                                         MI.getDebugLoc(), get(X86::MOV64rm));
       MIB.add(MI.getOperand(0)); // dst register

``````````

</details>


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


More information about the llvm-commits mailing list