@@ -31,6 +31,11 @@ sil @getContainsKlass : $@convention(thin) () -> @owned ContainsKlass
3131sil @useIndirect : $@convention(thin) <T> (@in_guaranteed T) -> ()
3232sil @sideEffect : $@convention(thin) () -> ()
3333
34+ enum FakeOptional<T> {
35+ case none
36+ case some(T)
37+ }
38+
3439//===----------------------------------------------------------------------===//
3540// MARK: Tests
3641//===----------------------------------------------------------------------===//
@@ -391,17 +396,63 @@ bb0(%0 : @owned $Klass, %1 : @guaranteed $KlassWithKlassPair):
391396 return %37 : $()
392397}
393398
394- // CHECK-LABEL: begin running test 1 of 1 on function_argument_inference_from_result : variable-name-inference with: @trace[0]
399+ // CHECK-LABEL: begin running test 1 of 1 on function_argument_inference_through_structextract : variable-name-inference with: @trace[0]
395400// CHECK: Input Value: %3 = copy_value %2 : $Klass
396401// CHECK: Name: 'self.lhs'
397402// CHECK: Root: %0 = argument of bb0 : $KlassPair
398- // CHECK: end running test 1 of 1 on function_argument_inference_from_result : variable-name-inference with: @trace[0]
399- sil [ossa] @function_argument_inference_from_result : $@convention(thin) (@guaranteed KlassPair) -> @owned Klass {
403+ // CHECK: end running test 1 of 1 on function_argument_inference_through_structextract : variable-name-inference with: @trace[0]
404+ sil [ossa] @function_argument_inference_through_structextract : $@convention(thin) (@guaranteed KlassPair) -> @owned Klass {
400405bb0(%0 : @guaranteed $KlassPair):
401406 specify_test "variable-name-inference @trace[0]"
402407 debug_value %0 : $KlassPair, let, name "self", argno 1, implicit
403408 %2 = struct_extract %0 : $KlassPair, #KlassPair.lhs
404409 %3 = copy_value %2 : $Klass
405410 debug_value [trace] %3 : $Klass
406411 return %3 : $Klass
407- }
412+ }
413+
414+ // CHECK-LABEL: begin running test 1 of 1 on function_argument_inference_through_uncheckedenumdata: variable-name-inference with: @trace[0]
415+ // CHECK: Input Value: %3 = copy_value %2 : $Klass
416+ // CHECK: Name: 'self.some'
417+ // CHECK: Root: %0 = argument of bb0 : $FakeOptional<Klass>
418+ // CHECK: end running test 1 of 1 on function_argument_inference_through_uncheckedenumdata: variable-name-inference with: @trace[0]
419+ sil [ossa] @function_argument_inference_through_uncheckedenumdata : $@convention(thin) (@guaranteed FakeOptional<Klass>) -> @owned Klass {
420+ bb0(%0 : @guaranteed $FakeOptional<Klass>):
421+ specify_test "variable-name-inference @trace[0]"
422+ debug_value %0 : $FakeOptional<Klass>, let, name "self", argno 1, implicit
423+ %2 = unchecked_enum_data %0 : $FakeOptional<Klass>, #FakeOptional.some!enumelt
424+ %3 = copy_value %2 : $Klass
425+ debug_value [trace] %3 : $Klass
426+ return %3 : $Klass
427+ }
428+
429+ // CHECK-LABEL: begin running test 1 of 1 on function_argument_inference_through_uncheckedtakeenumdataaddr: variable-name-inference with: @trace[0]
430+ // CHECK: Input Value: %3 = load [take] %2 : $*Klass
431+ // CHECK: Name: 'self.some'
432+ // CHECK: Root: %0 = argument of bb0 : $*FakeOptional<Klass>
433+ // CHECK: end running test 1 of 1 on function_argument_inference_through_uncheckedtakeenumdataaddr: variable-name-inference with: @trace[0]
434+ sil [ossa] @function_argument_inference_through_uncheckedtakeenumdataaddr : $@convention(thin) (@in FakeOptional<Klass>) -> @owned Klass {
435+ bb0(%0 : $*FakeOptional<Klass>):
436+ specify_test "variable-name-inference @trace[0]"
437+ debug_value %0 : $*FakeOptional<Klass>, let, name "self", argno 1, implicit
438+ %2 = unchecked_take_enum_data_addr %0 : $*FakeOptional<Klass>, #FakeOptional.some!enumelt
439+ %3 = load [take] %2 : $*Klass
440+ debug_value [trace] %3 : $Klass
441+ return %3 : $Klass
442+ }
443+
444+ // CHECK-LABEL: begin running test 1 of 1 on function_argument_inference_through_uncheckedtakeenumdataaddr_2: variable-name-inference with: @trace[0]
445+ // CHECK: Input Value: %2 = unchecked_take_enum_data_addr %0
446+ // CHECK: Name: 'self.some'
447+ // CHECK: Root: %0 = argument of bb0 : $*FakeOptional<Klass>
448+ // CHECK: end running test 1 of 1 on function_argument_inference_through_uncheckedtakeenumdataaddr_2: variable-name-inference with: @trace[0]
449+ sil [ossa] @function_argument_inference_through_uncheckedtakeenumdataaddr_2 : $@convention(thin) (@in FakeOptional<Klass>) -> @owned Klass {
450+ bb0(%0 : $*FakeOptional<Klass>):
451+ specify_test "variable-name-inference @trace[0]"
452+ debug_value %0 : $*FakeOptional<Klass>, let, name "self", argno 1, implicit
453+ %2 = unchecked_take_enum_data_addr %0 : $*FakeOptional<Klass>, #FakeOptional.some!enumelt
454+ debug_value [trace] %2 : $*Klass
455+ %3 = load [take] %2 : $*Klass
456+ return %3 : $Klass
457+ }
458+
0 commit comments