value_forwarding.carbon 1.3 KB

12345678910111213141516171819202122232425262728293031
  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. // AUTOUPDATE
  6. // TIP: To test this file alone, run:
  7. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/tuple/value_forwarding.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/tuple/value_forwarding.carbon
  10. fn G(ab: ((i32, i32, i32), (i32, i32, i32)));
  11. fn F(a: (i32, i32, i32), b: (i32, i32, i32)) {
  12. G((a, b));
  13. }
  14. // CHECK:STDOUT: ; ModuleID = 'value_forwarding.carbon'
  15. // CHECK:STDOUT: source_filename = "value_forwarding.carbon"
  16. // CHECK:STDOUT:
  17. // CHECK:STDOUT: declare void @G(ptr)
  18. // CHECK:STDOUT:
  19. // CHECK:STDOUT: define void @F(ptr %a, ptr %b) {
  20. // CHECK:STDOUT: entry:
  21. // CHECK:STDOUT: %tuple = alloca { ptr, ptr }, align 8
  22. // CHECK:STDOUT: %tuple1 = getelementptr inbounds { ptr, ptr }, ptr %tuple, i32 0, i32 0
  23. // CHECK:STDOUT: store ptr %a, ptr %tuple1, align 8
  24. // CHECK:STDOUT: %tuple2 = getelementptr inbounds { ptr, ptr }, ptr %tuple, i32 0, i32 1
  25. // CHECK:STDOUT: store ptr %b, ptr %tuple2, align 8
  26. // CHECK:STDOUT: call void @G(ptr %tuple)
  27. // CHECK:STDOUT: ret void
  28. // CHECK:STDOUT: }