[llvm-branch-commits] [llvm] [CodeGen] Allow rematerializer to rematerialize at the end of a block (PR #184339)

Lucas Ramirez via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Mar 24 06:34:30 PDT 2026


================
@@ -206,9 +211,12 @@ void Rematerializer::reviveRegIfDead(RegisterIdx RootIdx) {
 }
 
 void Rematerializer::transferUser(RegisterIdx FromRegIdx, RegisterIdx ToRegIdx,
-                                  MachineInstr &UserMI) {
+                                  unsigned UserRegion, MachineInstr &UserMI) {
+  assert(getReg(FromRegIdx).Uses.contains(UserRegion) && "no user in region");
+  assert(getReg(FromRegIdx).Uses.at(UserRegion).contains(&UserMI) &&
+         "not a region user");
----------------
lucas-rami wrote:

Thanks for the catch. These asserts are actually redundant with the one in `Rematerializer::Reg::eraseUser` that is called below (which doesn't do a double map lookup), so I removed them completely.

https://github.com/llvm/llvm-project/pull/184339


More information about the llvm-branch-commits mailing list