Skip to content

RegAllocBase: Avoid using temporary DiagnosticInfo #120046

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

arsenm
Copy link
Contributor

@arsenm arsenm commented Dec 16, 2024

No description provided.

@arsenm arsenm marked this pull request as ready for review December 16, 2024 07:18
Copy link
Contributor Author

arsenm commented Dec 16, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

@llvmbot
Copy link
Member

llvmbot commented Dec 16, 2024

@llvm/pr-subscribers-llvm-regalloc

Author: Matt Arsenault (arsenm)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/120046.diff

1 Files Affected:

  • (modified) llvm/lib/CodeGen/RegAllocBase.cpp (+4-6)
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()));
     }
   }
 

@arsenm arsenm merged commit a3db591 into main Dec 16, 2024
12 checks passed
@arsenm arsenm deleted the users/arsenm/regallocbase-avoid-temporary-diagnosticinfo branch December 16, 2024 07:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants