unreachable_end.carbon 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. fn Cond() -> bool;
  7. fn F();
  8. fn G();
  9. fn H();
  10. fn While() {
  11. F();
  12. while (Cond()) {
  13. G();
  14. return;
  15. }
  16. H();
  17. }
  18. // CHECK:STDOUT: --- unreachable_end.carbon
  19. // CHECK:STDOUT:
  20. // CHECK:STDOUT: constants {
  21. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  22. // CHECK:STDOUT: }
  23. // CHECK:STDOUT:
  24. // CHECK:STDOUT: file {
  25. // CHECK:STDOUT: package: <namespace> = namespace package, {.Cond = %Cond, .F = %F, .G = %G, .H = %H, .While = %While} [template]
  26. // CHECK:STDOUT: %Cond: <function> = fn_decl @Cond [template]
  27. // CHECK:STDOUT: %F: <function> = fn_decl @F [template]
  28. // CHECK:STDOUT: %G: <function> = fn_decl @G [template]
  29. // CHECK:STDOUT: %H: <function> = fn_decl @H [template]
  30. // CHECK:STDOUT: %While: <function> = fn_decl @While [template]
  31. // CHECK:STDOUT: }
  32. // CHECK:STDOUT:
  33. // CHECK:STDOUT: fn @Cond() -> bool;
  34. // CHECK:STDOUT:
  35. // CHECK:STDOUT: fn @F();
  36. // CHECK:STDOUT:
  37. // CHECK:STDOUT: fn @G();
  38. // CHECK:STDOUT:
  39. // CHECK:STDOUT: fn @H();
  40. // CHECK:STDOUT:
  41. // CHECK:STDOUT: fn @While() {
  42. // CHECK:STDOUT: !entry:
  43. // CHECK:STDOUT: %F.ref: <function> = name_ref F, file.%F [template = file.%F]
  44. // CHECK:STDOUT: %.loc14: init () = call %F.ref()
  45. // CHECK:STDOUT: br !while.cond
  46. // CHECK:STDOUT:
  47. // CHECK:STDOUT: !while.cond:
  48. // CHECK:STDOUT: %Cond.ref: <function> = name_ref Cond, file.%Cond [template = file.%Cond]
  49. // CHECK:STDOUT: %.loc15_14.1: init bool = call %Cond.ref()
  50. // CHECK:STDOUT: %.loc15_16: bool = value_of_initializer %.loc15_14.1
  51. // CHECK:STDOUT: %.loc15_14.2: bool = converted %.loc15_14.1, %.loc15_16
  52. // CHECK:STDOUT: if %.loc15_14.2 br !while.body else br !while.done
  53. // CHECK:STDOUT:
  54. // CHECK:STDOUT: !while.body:
  55. // CHECK:STDOUT: %G.ref: <function> = name_ref G, file.%G [template = file.%G]
  56. // CHECK:STDOUT: %.loc16: init () = call %G.ref()
  57. // CHECK:STDOUT: return
  58. // CHECK:STDOUT:
  59. // CHECK:STDOUT: !while.done:
  60. // CHECK:STDOUT: %H.ref: <function> = name_ref H, file.%H [template = file.%H]
  61. // CHECK:STDOUT: %.loc19: init () = call %H.ref()
  62. // CHECK:STDOUT: return
  63. // CHECK:STDOUT: }
  64. // CHECK:STDOUT: