File tree Expand file tree Collapse file tree 2 files changed +6
-0
lines changed Expand file tree Collapse file tree 2 files changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -362,6 +362,8 @@ class DeadFunctionAndGlobalElimination {
362362 ensureKeyPathComponentIsAlive (component);
363363 } else if (auto *GA = dyn_cast<GlobalAddrInst>(&I)) {
364364 ensureAlive (GA->getReferencedGlobal ());
365+ } else if (auto *agi = dyn_cast<AllocGlobalInst>(&I)) {
366+ ensureAlive (agi->getReferencedGlobal ());
365367 } else if (auto *GV = dyn_cast<GlobalValueInst>(&I)) {
366368 ensureAlive (GV->getReferencedGlobal ());
367369 } else if (auto *HSI = dyn_cast<HasSymbolInst>(&I)) {
Original file line number Diff line number Diff line change @@ -6,6 +6,9 @@ sil_stage canonical
66import Builtin
77import Swift
88
9+ // CHECK-LABEL: sil_global private @privateGlobal
10+ sil_global private @privateGlobal : $Int64
11+
912// This function needs to be removed.
1013// KEEP-NOT: @remove_me
1114
@@ -25,6 +28,7 @@ sil_global @globalFunctionPointer : $@callee_guaranteed () -> () = {
2528// CHECK-LABEL: sil private @alivePrivateFunc
2629sil private @alivePrivateFunc : $@convention(thin) () -> () {
2730bb0:
31+ alloc_global @privateGlobal
2832 %0 = tuple ()
2933 return %0 : $()
3034}
You can’t perform that action at this time.
0 commit comments