From 2006284d690790b0f43a2ff48a9e291b465853c2 Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Mon, 16 Dec 2024 14:14:05 +0700 Subject: [PATCH] RegAllocBase: Avoid using temporary DiagnosticInfo --- llvm/lib/CodeGen/RegAllocBase.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/llvm/lib/CodeGen/RegAllocBase.cpp b/llvm/lib/CodeGen/RegAllocBase.cpp index 980a6756963d9..50addcbcca065 100644 --- a/llvm/lib/CodeGen/RegAllocBase.cpp +++ b/llvm/lib/CodeGen/RegAllocBase.cpp @@ -200,10 +200,9 @@ MCPhysReg RegAllocBase::getErrorAssignment(const TargetRegisterClass &RC, ArrayRef RawRegs = RC.getRegisters(); if (EmitError) { - DiagnosticInfoRegAllocFailure DI( + Context.diagnose(DiagnosticInfoRegAllocFailure( "no registers from class available to allocate", Fn, - CtxMI ? CtxMI->getDebugLoc() : DiagnosticLocation()); - Context.diagnose(DI); + CtxMI ? CtxMI->getDebugLoc() : DiagnosticLocation())); } assert(!RawRegs.empty() && "register classes cannot have no registers"); @@ -215,10 +214,9 @@ MCPhysReg RegAllocBase::getErrorAssignment(const TargetRegisterClass &RC, CtxMI->emitInlineAsmError( "inline assembly requires more registers than available"); } else { - DiagnosticInfoRegAllocFailure DI( + Context.diagnose(DiagnosticInfoRegAllocFailure( "ran out of registers during register allocation", Fn, - CtxMI ? CtxMI->getDebugLoc() : DiagnosticLocation()); - Context.diagnose(DI); + CtxMI ? CtxMI->getDebugLoc() : DiagnosticLocation())); } }