[llvm] [X86] Fix LEA compression on 64 bit (PR #166334)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 4 01:49:54 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-x86
Author: Tomer Shafir (tomershafir)
<details>
<summary>Changes</summary>
NDD ADD is only supported on 64 bit, but `LEA32`` has `Requires<[Not64BitMode]>`. The reason it doesnt fail upstream is that the predicates check is commented out on `X86MCInstLower.cpp`:
```
// FIXME: Enable feature predicate checks once all the test pass.
// X86_MC::verifyInstructionPredicates(MI->getOpcode(),
// Subtarget->getFeatureBits());
```
Introduced by: https://github.com/llvm/llvm-project/pull/158254
---
Full diff: https://github.com/llvm/llvm-project/pull/166334.diff
1 Files Affected:
- (modified) llvm/lib/Target/X86/X86CompressEVEX.cpp (+1-1)
``````````diff
diff --git a/llvm/lib/Target/X86/X86CompressEVEX.cpp b/llvm/lib/Target/X86/X86CompressEVEX.cpp
index c0c7f5adf06ef..ddbd10d8f7eda 100644
--- a/llvm/lib/Target/X86/X86CompressEVEX.cpp
+++ b/llvm/lib/Target/X86/X86CompressEVEX.cpp
@@ -272,7 +272,7 @@ static bool CompressEVEXImpl(MachineInstr &MI, MachineBasicBlock &MBB,
const MachineOperand &Src2 = MI.getOperand(2);
bool Is32BitReg = Opc == X86::ADD32ri_ND || Opc == X86::ADD32rr_ND;
const MCInstrDesc &NewDesc =
- ST.getInstrInfo()->get(Is32BitReg ? X86::LEA32r : X86::LEA64r);
+ ST.getInstrInfo()->get(Is32BitReg ? X86::LEA64_32r : X86::LEA64r);
if (Is32BitReg)
Src1 = getX86SubSuperRegister(Src1, 64);
MachineInstrBuilder MIB = BuildMI(MBB, MI, MI.getDebugLoc(), NewDesc, Dst)
``````````
</details>
https://github.com/llvm/llvm-project/pull/166334
More information about the llvm-commits
mailing list