diff --git a/llvm/lib/CodeGen/RegAllocFast.cpp b/llvm/lib/CodeGen/RegAllocFast.cpp index c31e7201796e6..3863ca80bb44e 100644 --- a/llvm/lib/CodeGen/RegAllocFast.cpp +++ b/llvm/lib/CodeGen/RegAllocFast.cpp @@ -1187,10 +1187,9 @@ MCPhysReg RegAllocFastImpl::getErrorAssignment(const LiveReg &LR, if (AllocationOrder.empty()) { const Function &Fn = MF.getFunction(); if (EmitError) { - DiagnosticInfoRegAllocFailure DI( + Fn.getContext().diagnose(DiagnosticInfoRegAllocFailure( "no registers from class available to allocate", Fn, - MI.getDebugLoc()); - Fn.getContext().diagnose(DI); + MI.getDebugLoc())); } ArrayRef RawRegs = RC.getRegisters();