Index: lib/Target/X86/X86FastISel.cpp =================================================================== --- lib/Target/X86/X86FastISel.cpp +++ lib/Target/X86/X86FastISel.cpp @@ -3344,6 +3344,17 @@ if (!Result) return false; + MCInstrDesc MCID = Result->getDesc(); + for (size_t i = 0; i < AddrOps.size(); ++i) { + MachineOperand &MO = AddrOps[i]; + if (MO.getType() != MachineOperand::MO_Register) + continue; + unsigned Reg = MO.getReg(); + if (!Reg || TargetRegisterInfo::isPhysicalRegister(Reg)) + continue; + MRI.constrainRegClass(Reg, TII.getRegClass(MCID, i, &TRI, *FuncInfo.MF)); + } + Result->addMemOperand(*FuncInfo.MF, createMachineMemOperandFor(LI)); FuncInfo.MBB->insert(FuncInfo.InsertPt, Result); MI->eraseFromParent(); Index: test/CodeGen/X86/fast-isel-regclass.ll =================================================================== --- /dev/null +++ test/CodeGen/X86/fast-isel-regclass.ll @@ -0,0 +1,30 @@ +; RUN: llc < %s -fast-isel -mcpu=core2 -O3 -verify-machineinstrs +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-apple-darwin14.0.0" + +define void @julia_ht_keyindex219890() { +top: + br i1 undef, label %idxend, label %oob + +if3: ; preds = %idxend + br i1 undef, label %L5, label %if4 + +oob: ; preds = %top + unreachable + +idxend: ; preds = %top + %0 = getelementptr i8* undef, i64 undef + %1 = load i8* %0 + %2 = icmp eq i8 %1, undef + %3 = xor i1 %2, true + br i1 %3, label %oob9, label %if3 + +if4: ; preds = %if3 + ret void + +L5: ; preds = %if3 + ret void + +oob9: ; preds = %idxend + unreachable +}