Skip to content

Commit 0f049e6

Browse files
authored
Merge pull request swiftlang#75758 from gottesmm/pr-3a557eb335e20908cb75b7e87305641a776a6dc3
[variable-name-utils] Look through convert function when finding names.
2 parents 447ce81 + 2e13802 commit 0f049e6

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

lib/SILOptimizer/Utils/VariableNameUtils.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,8 @@ SILValue VariableNameInferrer::findDebugInfoProvidingValueHelper(
628628
isa<MoveOnlyWrapperToCopyableValueInst>(searchValue) ||
629629
isa<CopyableToMoveOnlyWrapperValueInst>(searchValue) ||
630630
isa<EndInitLetRefInst>(searchValue) ||
631-
isa<ConvertEscapeToNoEscapeInst>(searchValue)) {
631+
isa<ConvertEscapeToNoEscapeInst>(searchValue) ||
632+
isa<ConvertFunctionInst>(searchValue)) {
632633
searchValue = cast<SingleValueInstruction>(searchValue)->getOperand(0);
633634
continue;
634635
}

test/SILOptimizer/variable_name_inference.sil

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -919,3 +919,21 @@ bb0:
919919
%9999 = tuple ()
920920
return %9999 : $()
921921
}
922+
923+
// CHECK-LABEL: begin running test 1 of 1 on infer_through_convert_function: variable_name_inference with: @trace[0]
924+
// CHECK: Input Value: // function_ref sideEffect
925+
// CHECK-NEXT: %0 = function_ref @sideEffect
926+
// CHECK: Name: 'closure'
927+
// CHECK: Root: // function_ref sideEffect
928+
// CHECK-NEXT: %0 = function_ref @sideEffect
929+
// CHECK: end running test 1 of 1 on infer_through_convert_function: variable_name_inference with: @trace[0]
930+
sil [ossa] @infer_through_convert_function : $@convention(thin) () -> () {
931+
bb0:
932+
specify_test "variable_name_inference @trace[0]"
933+
%0 = function_ref @sideEffect : $@convention(thin) () -> ()
934+
debug_value %0 : $@convention(thin) () -> (), let, name "closure"
935+
%1 = convert_function %0 : $@convention(thin) () -> () to $@convention(thin) () -> ()
936+
debug_value [trace] %0 : $@convention(thin) () -> ()
937+
%9999 = tuple ()
938+
return %9999 : $()
939+
}

0 commit comments

Comments
 (0)