@@ -626,6 +626,11 @@ class TransferTracker {
626
626
void redefVar (const MachineInstr &MI) {
627
627
DebugVariable Var (MI.getDebugVariable (), MI.getDebugExpression (),
628
628
MI.getDebugLoc ()->getInlinedAt ());
629
+ // BEGIN SWIFT
630
+ if (IsSwiftAsyncFunction && MI.getDebugExpression () &&
631
+ MI.getDebugExpression ()->isEntryValue ())
632
+ return ;
633
+ // END SWIFT
629
634
DbgValueProperties Properties (MI);
630
635
631
636
// Ignore non-register locations, we don't transfer those.
@@ -763,6 +768,10 @@ class TransferTracker {
763
768
if (!NewLoc && !MakeUndef) {
764
769
// Try and recover a few more locations with entry values.
765
770
for (const auto &Var : ActiveMLocIt->second ) {
771
+ // BEGIN SWIFT
772
+ if (ActiveVLocs.find (Var) == ActiveVLocs.end ())
773
+ continue ;
774
+ // END SWIFT
766
775
auto &Prop = ActiveVLocs.find (Var)->second .Properties ;
767
776
recoverAsEntryValue (Var, Prop, OldValue);
768
777
}
@@ -777,6 +786,11 @@ class TransferTracker {
777
786
SmallVector<std::pair<LocIdx, DebugVariable>> LostMLocs;
778
787
for (const auto &Var : ActiveMLocIt->second ) {
779
788
auto ActiveVLocIt = ActiveVLocs.find (Var);
789
+ // BEGIN SWIFT
790
+ if (ActiveVLocs.find (Var) == ActiveVLocs.end ())
791
+ continue ;
792
+ // END SWIFT
793
+
780
794
// Re-state the variable location: if there's no replacement then NewLoc
781
795
// is None and a $noreg DBG_VALUE will be created. Otherwise, a DBG_VALUE
782
796
// identifying the alternative location will be emitted.
@@ -788,8 +802,8 @@ class TransferTracker {
788
802
SmallVector<ResolvedDbgOp> DbgOps;
789
803
// BEGIN SWIFT
790
804
// Async support: Don't track spills for entry values.
791
- if (IsSwiftAsyncFunction && ActiveVLocIt-> second . Properties .DIExpr &&
792
- ActiveVLocIt-> second . Properties .DIExpr ->isEntryValue ())
805
+ if (IsSwiftAsyncFunction && Properties.DIExpr &&
806
+ Properties.DIExpr ->isEntryValue ())
793
807
DbgOps.push_back (MLoc);
794
808
else
795
809
// END SWIFT
@@ -864,18 +878,19 @@ class TransferTracker {
864
878
ResolvedDbgOp DstOp (Dst);
865
879
for (const auto &Var : MovingVars) {
866
880
auto ActiveVLocIt = ActiveVLocs.find (Var);
867
- assert (ActiveVLocIt != ActiveVLocs.end ());
868
-
869
881
// BEGIN SWIFT
870
882
// Async support: Don't track transfers for entry values.
871
- if (IsSwiftAsyncFunction && ActiveVLocIt->second .Properties .DIExpr &&
872
- ActiveVLocIt->second .Properties .DIExpr ->isEntryValue ()) {
883
+ if (ActiveVLocIt == ActiveVLocs.end ()) {
873
884
// Leave SrcOp in-situ.
874
- } else
885
+ continue ;
886
+ }
875
887
// END SWIFT
876
- // Update all instances of Src in the variable's tracked values to Dst.
877
- std::replace (ActiveVLocIt->second .Ops .begin (),
878
- ActiveVLocIt->second .Ops .end (), SrcOp, DstOp);
888
+
889
+ assert (ActiveVLocIt != ActiveVLocs.end ());
890
+
891
+ // Update all instances of Src in the variable's tracked values to Dst.
892
+ std::replace (ActiveVLocIt->second .Ops .begin (),
893
+ ActiveVLocIt->second .Ops .end (), SrcOp, DstOp);
879
894
880
895
MachineInstr *MI = MTracker->emitLoc (ActiveVLocIt->second .Ops , Var,
881
896
ActiveVLocIt->second .Properties );
0 commit comments