-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[X86] Fix LEA compression on 64 bit #166334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[X86] Fix LEA compression on 64 bit #166334
Conversation
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: llvm#158254
|
@llvm/pr-subscribers-backend-x86 Author: Tomer Shafir (tomershafir) ChangesNDD ADD is only supported on 64 bit, but Introduced by: #158254 Full diff: https://github.com/llvm/llvm-project/pull/166334.diff 1 Files Affected:
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)
|
|
@tomershafir Are you working towards properly enabling verifyInstructionPredicates ? |
|
No, I have just seen this failing on tests with the verification enabled |
|
@RKSimon Feel free to add a review, it would be helpful to merge it fast |
phoebewang
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for the fix!
fzou1
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
NDD ADD is only supported on 64 bit, but
LEA32hasRequires<[Not64BitMode]>. The reason it doesnt fail upstream is that the predicates check is commented out onX86MCInstLower.cpp:Introduced by: #158254