[llvm] [CodeGen] Notify LRE delegate before foldAsLoad erases UseMI (PR #226250)
Sam Valladares via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 24 11:03:35 PDT 2026
https://github.com/samvallad33 updated https://github.com/llvm/llvm-project/pull/226250
>From 078fdf1118cddc0d39beeaa3ccf48529a39f16e5 Mon Sep 17 00:00:00 2001
From: Sam Valladares <liverpool1.fan10 at gmail.com>
Date: Thu, 24 Sep 2026 10:54:34 -0700
Subject: [PATCH] [CodeGen] Notify LRE delegate before foldAsLoad erases UseMI
foldAsLoad was missing the LRE_WillEraseInstruction notify that
eliminateDeadDef already does before erase.
Fixes #222905
Assisted-by: Cursor
Signed-off-by: Sam Valladares <liverpool1.fan10 at gmail.com>
---
llvm/lib/CodeGen/LiveRangeEdit.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/llvm/lib/CodeGen/LiveRangeEdit.cpp b/llvm/lib/CodeGen/LiveRangeEdit.cpp
index 1d6b835f16468..3d25e204743e8 100644
--- a/llvm/lib/CodeGen/LiveRangeEdit.cpp
+++ b/llvm/lib/CodeGen/LiveRangeEdit.cpp
@@ -161,6 +161,8 @@ bool LiveRangeEdit::foldAsLoad(LiveInterval *LI,
// Update the call info.
if (UseMI->shouldUpdateAdditionalCallInfo())
UseMI->getMF()->moveAdditionalCallInfo(UseMI, FoldMI);
+ if (TheDelegate)
+ TheDelegate->LRE_WillEraseInstruction(UseMI);
UseMI->eraseFromParent();
DefMI->addRegisterDead(LI->reg(), nullptr);
Dead.push_back(DefMI);
More information about the llvm-commits
mailing list