value_forwarding.carbon 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. //
  5. // INCLUDE-FILE: toolchain/testing/testdata/min_prelude/int.carbon
  6. //
  7. // AUTOUPDATE
  8. // TIP: To test this file alone, run:
  9. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/tuple/value_forwarding.carbon
  10. // TIP: To dump output, run:
  11. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/tuple/value_forwarding.carbon
  12. fn G(ab: ((i32, i32, i32), (i32, i32, i32)));
  13. fn F(a: (i32, i32, i32), b: (i32, i32, i32)) {
  14. G((a, b));
  15. }
  16. // CHECK:STDOUT: ; ModuleID = 'value_forwarding.carbon'
  17. // CHECK:STDOUT: source_filename = "value_forwarding.carbon"
  18. // CHECK:STDOUT:
  19. // CHECK:STDOUT: declare void @_CG.Main(ptr)
  20. // CHECK:STDOUT:
  21. // CHECK:STDOUT: ; Function Attrs: nounwind
  22. // CHECK:STDOUT: define void @_CF.Main(ptr %a, ptr %b) #0 !dbg !4 {
  23. // CHECK:STDOUT: entry:
  24. // CHECK:STDOUT: %tuple = alloca { ptr, ptr }, align 8, !dbg !11
  25. // CHECK:STDOUT: %tuple1 = getelementptr inbounds nuw { ptr, ptr }, ptr %tuple, i32 0, i32 0, !dbg !11
  26. // CHECK:STDOUT: store ptr %a, ptr %tuple1, align 8, !dbg !11
  27. // CHECK:STDOUT: %tuple2 = getelementptr inbounds nuw { ptr, ptr }, ptr %tuple, i32 0, i32 1, !dbg !11
  28. // CHECK:STDOUT: store ptr %b, ptr %tuple2, align 8, !dbg !11
  29. // CHECK:STDOUT: call void @_CG.Main(ptr %tuple), !dbg !12
  30. // CHECK:STDOUT: ret void, !dbg !13
  31. // CHECK:STDOUT: }
  32. // CHECK:STDOUT:
  33. // CHECK:STDOUT: attributes #0 = { nounwind }
  34. // CHECK:STDOUT:
  35. // CHECK:STDOUT: !llvm.module.flags = !{!0, !1}
  36. // CHECK:STDOUT: !llvm.dbg.cu = !{!2}
  37. // CHECK:STDOUT:
  38. // CHECK:STDOUT: !0 = !{i32 7, !"Dwarf Version", i32 5}
  39. // CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3}
  40. // CHECK:STDOUT: !2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug)
  41. // CHECK:STDOUT: !3 = !DIFile(filename: "value_forwarding.carbon", directory: "")
  42. // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "F", linkageName: "_CF.Main", scope: null, file: !3, line: 15, type: !5, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !8)
  43. // CHECK:STDOUT: !5 = !DISubroutineType(types: !6)
  44. // CHECK:STDOUT: !6 = !{null, !7, !7}
  45. // CHECK:STDOUT: !7 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 8)
  46. // CHECK:STDOUT: !8 = !{!9, !10}
  47. // CHECK:STDOUT: !9 = !DILocalVariable(arg: 1, scope: !4, type: !7)
  48. // CHECK:STDOUT: !10 = !DILocalVariable(arg: 2, scope: !4, type: !7)
  49. // CHECK:STDOUT: !11 = !DILocation(line: 16, column: 5, scope: !4)
  50. // CHECK:STDOUT: !12 = !DILocation(line: 16, column: 3, scope: !4)
  51. // CHECK:STDOUT: !13 = !DILocation(line: 15, column: 1, scope: !4)