[llvm] [llvm][X86] REX profile for UEFI (PR #138362)

via llvm-commits llvm-commits at lists.llvm.org
Fri May 2 16:29:42 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-x86

Author: Prabhu Rajasekaran (Prabhuk)

<details>
<summary>Changes</summary>

Use the appropriate REX profile for UEFI X86_64 target.


---
Full diff: https://github.com/llvm/llvm-project/pull/138362.diff


1 Files Affected:

- (modified) llvm/lib/Target/X86/X86ExpandPseudo.cpp (+6-5) 


``````````diff
diff --git a/llvm/lib/Target/X86/X86ExpandPseudo.cpp b/llvm/lib/Target/X86/X86ExpandPseudo.cpp
index 398b738b85697..5d1f7f7f0fe9d 100644
--- a/llvm/lib/Target/X86/X86ExpandPseudo.cpp
+++ b/llvm/lib/Target/X86/X86ExpandPseudo.cpp
@@ -302,7 +302,7 @@ bool X86ExpandPseudo::expandMI(MachineBasicBlock &MBB,
     }
 
     // Jump to label or value in register.
-    bool IsWin64 = STI->isTargetWin64();
+    bool IsWinOrUEFI64 = STI->isTargetWin64() || STI->isTargetUEFI64();
     if (Opcode == X86::TCRETURNdi || Opcode == X86::TCRETURNdicc ||
         Opcode == X86::TCRETURNdi64 || Opcode == X86::TCRETURNdi64cc) {
       unsigned Op;
@@ -339,16 +339,17 @@ bool X86ExpandPseudo::expandMI(MachineBasicBlock &MBB,
       }
 
     } else if (Opcode == X86::TCRETURNmi || Opcode == X86::TCRETURNmi64) {
-      unsigned Op = (Opcode == X86::TCRETURNmi)
-                        ? X86::TAILJMPm
-                        : (IsWin64 ? X86::TAILJMPm64_REX : X86::TAILJMPm64);
+      unsigned Op =
+          (Opcode == X86::TCRETURNmi)
+              ? X86::TAILJMPm
+              : (IsWinOrUEFI64 ? X86::TAILJMPm64_REX : X86::TAILJMPm64);
       MachineInstrBuilder MIB = BuildMI(MBB, MBBI, DL, TII->get(Op));
       for (unsigned i = 0; i != X86::AddrNumOperands; ++i)
         MIB.add(MBBI->getOperand(i));
     } else if (Opcode == X86::TCRETURNri64) {
       JumpTarget.setIsKill();
       BuildMI(MBB, MBBI, DL,
-              TII->get(IsWin64 ? X86::TAILJMPr64_REX : X86::TAILJMPr64))
+              TII->get(IsWinOrUEFI64 ? X86::TAILJMPr64_REX : X86::TAILJMPr64))
           .add(JumpTarget);
     } else {
       JumpTarget.setIsKill();

``````````

</details>


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


More information about the llvm-commits mailing list