llvm backend: fix not updating map after deleting global

This was uncaught UB!
This commit is contained in:
Andrew Kelley 2022-01-24 11:39:32 -07:00
parent b34f994c0b
commit 65576ea2ea

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();
}