llvm backend: fix not updating map after deleting global

This was uncaught UB!
This commit is contained in:
Andrew Kelley committed 2022-01-24 21:47:53 -07:00
1 parent b34f994c0b
commit 65576ea2ea
1 file changed
+1
+1
View File
@@ -662,6 +662,7 @@ pub const DeclGen = struct {
new_global.setAlignment(global.getAlignment());
new_global.setInitializer(llvm_init);
global.replaceAllUsesWith(new_global);
dg.object.decl_map.putAssumeCapacity(decl, new_global);
new_global.takeName(global);
global.deleteGlobal();
}