From 2967a804126c6081a18d8b75adf2d9fd5a3c096e Mon Sep 17 00:00:00 2001 From: Preston Gurd Date: Mon, 30 Sep 2013 23:18:42 +0000 Subject: [PATCH] The X86FixupLEAs pass for Intel Atom must not call convertToThreeAddress on ADD16rr opcodes, if src1 != src, since that would cause convertToThreeAddress to try to create a virtual register. This is not permitted after register allocation, which is when the X86FixupLEAs pass runs. This patch fixes PR16785. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191711 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/X86/X86FixupLEAs.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/Target/X86/X86FixupLEAs.cpp b/lib/Target/X86/X86FixupLEAs.cpp index d21cb8aa076..fd42ecd3fac 100644 --- a/lib/Target/X86/X86FixupLEAs.cpp +++ b/lib/Target/X86/X86FixupLEAs.cpp @@ -125,6 +125,14 @@ FixupLEAPass::postRAConvertToLEA(MachineFunction::iterator &MFI, // which requires isImm() to be true return 0; } + case X86::ADD16rr: + case X86::ADD16rr_DB: + if (MI->getOperand(1).getReg() != MI->getOperand(2).getReg()) { + // if src1 != src2, then convertToThreeAddress will + // need to create a Virtual register, which we cannot do + // after register allocation. + return 0; + } } return TII->convertToThreeAddress(MFI, MBBI, 0); }