The X86FixupLEAs pass for Intel Atom must not call convertToThreeAddress
authorPreston Gurd <preston.gurd@intel.com>
Mon, 30 Sep 2013 23:18:42 +0000 (23:18 +0000)
committerPreston Gurd <preston.gurd@intel.com>
Mon, 30 Sep 2013 23:18:42 +0000 (23:18 +0000)
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

index d21cb8aa0761c0666c098e55fea38c88d456f287..fd42ecd3fac1df79a4bc3829dc80bf9a3fc13700 100644 (file)
@@ -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);
 }