[llvm] a3db591 - RegAllocBase: Avoid using temporary DiagnosticInfo (#120046)

via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 15 23:57:18 PST 2024


Author: Matt Arsenault
Date: 2024-12-16T14:57:13+07:00
New Revision: a3db5910b434d746c9c0585a092100ff7abcd1a0

URL: https://github.com/llvm/llvm-project/commit/a3db5910b434d746c9c0585a092100ff7abcd1a0
DIFF: https://github.com/llvm/llvm-project/commit/a3db5910b434d746c9c0585a092100ff7abcd1a0.diff

LOG: RegAllocBase: Avoid using temporary DiagnosticInfo (#120046)

Added: 
    

Modified: 
    llvm/lib/CodeGen/RegAllocBase.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/RegAllocBase.cpp b/llvm/lib/CodeGen/RegAllocBase.cpp
index 980a6756963d9f..50addcbcca065a 100644
--- a/llvm/lib/CodeGen/RegAllocBase.cpp
+++ b/llvm/lib/CodeGen/RegAllocBase.cpp
@@ -200,10 +200,9 @@ MCPhysReg RegAllocBase::getErrorAssignment(const TargetRegisterClass &RC,
     ArrayRef<MCPhysReg> 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()));
     }
   }
 


        


More information about the llvm-commits mailing list