Skip to content

Conversation

@kazutakahirata
Copy link
Contributor

No description provided.

@llvmbot
Copy link
Member

llvmbot commented Feb 3, 2025

@llvm/pr-subscribers-llvm-regalloc

Author: Kazu Hirata (kazutakahirata)

Changes

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

1 Files Affected:

  • (modified) llvm/include/llvm/CodeGen/LiveIntervals.h (+6-4)
diff --git a/llvm/include/llvm/CodeGen/LiveIntervals.h b/llvm/include/llvm/CodeGen/LiveIntervals.h
index 540651ea114427..708917be497ef6 100644
--- a/llvm/include/llvm/CodeGen/LiveIntervals.h
+++ b/llvm/include/llvm/CodeGen/LiveIntervals.h
@@ -149,8 +149,9 @@ class LiveIntervals {
   LiveInterval &createEmptyInterval(Register Reg) {
     assert(!hasInterval(Reg) && "Interval already exists!");
     VirtRegIntervals.grow(Reg.id());
-    VirtRegIntervals[Reg.id()] = createInterval(Reg);
-    return *VirtRegIntervals[Reg.id()];
+    auto &Interval = VirtRegIntervals[Reg.id()];
+    Interval = createInterval(Reg);
+    return *Interval;
   }
 
   LiveInterval &createAndComputeVirtRegInterval(Register Reg) {
@@ -168,8 +169,9 @@ class LiveIntervals {
 
   /// Interval removal.
   void removeInterval(Register Reg) {
-    delete VirtRegIntervals[Reg];
-    VirtRegIntervals[Reg] = nullptr;
+    auto &Interval = VirtRegIntervals[Reg];
+    delete Interval;
+    Interval = nullptr;
   }
 
   /// Given a register and an instruction, adds a live segment from that

@kazutakahirata kazutakahirata merged commit 22bc029 into llvm:main Feb 3, 2025
7 of 10 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_001_repeated_hash_lookups_llvm_CodeGen branch February 3, 2025 20:29
Icohedron pushed a commit to Icohedron/llvm-project that referenced this pull request Feb 11, 2025
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.

3 participants