File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
lib/SILOptimizer/SILCombiner Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -871,6 +871,11 @@ SILInstruction *SILCombiner::createApplyWithConcreteType(
871
871
ArgIdx < EndIdx; ++ArgIdx) {
872
872
NewArgs.push_back (Apply.getArgument (ArgIdx));
873
873
}
874
+
875
+ // Keep track of weather we made any updates at all. Otherwise, we will
876
+ // have an infinite loop.
877
+ bool madeUpdate = false ;
878
+
874
879
// Transform the parameter arguments.
875
880
SmallVector<ConcreteArgumentCopy, 4 > concreteArgCopies;
876
881
for (unsigned EndIdx = Apply.getNumArguments (); ArgIdx < EndIdx; ++ArgIdx) {
@@ -898,6 +903,7 @@ SILInstruction *SILCombiner::createApplyWithConcreteType(
898
903
if (argSub) {
899
904
concreteArgCopies.push_back (*argSub);
900
905
NewArgs.push_back (argSub->tempArg );
906
+ madeUpdate = true ;
901
907
} else {
902
908
NewArgs.push_back (CEI.ConcreteValue );
903
909
}
@@ -939,7 +945,7 @@ SILInstruction *SILCombiner::createApplyWithConcreteType(
939
945
return canUpdate;
940
946
}();
941
947
942
- if (!canUpdateArgs) {
948
+ if (!canUpdateArgs || !madeUpdate ) {
943
949
// Remove any new instructions created while attempting to optimize this
944
950
// apply. Since the apply was never rewritten, if they aren't removed here,
945
951
// they will be removed later as dead when visited by SILCombine, causing
You can’t perform that action at this time.
0 commit comments