call_recursive_sccs_deep.carbon 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461
  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/function/generic/call_recursive_sccs_deep.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/function/generic/call_recursive_sccs_deep.carbon
  10. import Core library "io";
  11. fn A[T:! type](x: T, count: i32) -> T;
  12. fn B[T:! type](x: T, count: i32);
  13. fn C[T:! type](x: T, count: i32);
  14. fn D[T:! type](x: T, count: i32) -> T;
  15. fn E[T:! type](x: T, count: i32) -> T;
  16. fn F[T:! type](x: T, count: i32) -> T;
  17. // Builds on `call_recursive_mutual.carbon` and `call_recursive_diamond.carbon`
  18. // B-C form a mutually recursive SCC (strongly connected component), D-E-F-G
  19. // form a diamond SCC.
  20. // The two specifics for each of A, B, C, D, E, F, G with a pointer type could
  21. // be deduplicated.
  22. // E and F are also equivalent in the diamond, even though they are different
  23. // generics. There is potential front-end ICF (identical code folding)
  24. // optimization here, if the function fingerprint may infer deduplication
  25. // when not including the two different generic_ids.
  26. fn A[T:! type](x: T, count: i32) -> T {
  27. B(x, count);
  28. return D(x, count);
  29. }
  30. fn B[T:! type](x: T, count: i32) {
  31. C(x, count);
  32. }
  33. fn C[T:! type](x: T, count: i32) {
  34. if (count <= 2) {
  35. Core.Print(count);
  36. B(x, count + 1);
  37. }
  38. }
  39. fn D[T:! type](x: T, count: i32) -> T {
  40. if (count > 4) {
  41. return x;
  42. }
  43. if (count % 2 == 0) {
  44. return E(x, count);
  45. } else {
  46. return F(x, count);
  47. }
  48. }
  49. fn G[T:! type](x: T, count: i32) -> T;
  50. fn E[T:! type](x: T, count: i32) -> T {
  51. return G(x, count);
  52. }
  53. fn F[T:! type](x: T, count: i32) -> T {
  54. return G(x, count);
  55. }
  56. fn G[T:! type](x: T, count: i32) -> T {
  57. return D(x, count + 1);
  58. }
  59. fn M() {
  60. var n: i32 = 0;
  61. var m: f64 = 1.0;
  62. var ptr_i32 : i32*;
  63. var ptr_f64 : f64*;
  64. A(n, 0);
  65. A(m, 0);
  66. A(ptr_i32, 0);
  67. A(ptr_f64, 0);
  68. }
  69. // CHECK:STDOUT: ; ModuleID = 'call_recursive_sccs_deep.carbon'
  70. // CHECK:STDOUT: source_filename = "call_recursive_sccs_deep.carbon"
  71. // CHECK:STDOUT:
  72. // CHECK:STDOUT: @printf.int.format = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
  73. // CHECK:STDOUT:
  74. // CHECK:STDOUT: define void @_CM.Main() !dbg !4 {
  75. // CHECK:STDOUT: entry:
  76. // CHECK:STDOUT: %n.var = alloca i32, align 4, !dbg !7
  77. // CHECK:STDOUT: %m.var = alloca double, align 8, !dbg !8
  78. // CHECK:STDOUT: %ptr_i32.var = alloca ptr, align 8, !dbg !9
  79. // CHECK:STDOUT: %ptr_f64.var = alloca ptr, align 8, !dbg !10
  80. // CHECK:STDOUT: call void @llvm.lifetime.start.p0(i64 4, ptr %n.var), !dbg !7
  81. // CHECK:STDOUT: store i32 0, ptr %n.var, align 4, !dbg !7
  82. // CHECK:STDOUT: call void @llvm.lifetime.start.p0(i64 8, ptr %m.var), !dbg !8
  83. // CHECK:STDOUT: store double 1.000000e+00, ptr %m.var, align 8, !dbg !8
  84. // CHECK:STDOUT: call void @llvm.lifetime.start.p0(i64 8, ptr %ptr_i32.var), !dbg !9
  85. // CHECK:STDOUT: call void @llvm.lifetime.start.p0(i64 8, ptr %ptr_f64.var), !dbg !10
  86. // CHECK:STDOUT: %.loc77_5 = load i32, ptr %n.var, align 4, !dbg !11
  87. // CHECK:STDOUT: %A.call.loc77 = call i32 @_CA.Main.b88d1103f417c6d4(i32 %.loc77_5, i32 0), !dbg !12
  88. // CHECK:STDOUT: %.loc78_5 = load double, ptr %m.var, align 8, !dbg !13
  89. // CHECK:STDOUT: %A.call.loc78 = call double @_CA.Main.66be507887ceee78(double %.loc78_5, i32 0), !dbg !14
  90. // CHECK:STDOUT: %.loc79_5 = load ptr, ptr %ptr_i32.var, align 8, !dbg !15
  91. // CHECK:STDOUT: %A.call.loc79 = call ptr @_CA.Main.e8193710fd35b608(ptr %.loc79_5, i32 0), !dbg !16
  92. // CHECK:STDOUT: %.loc80_5 = load ptr, ptr %ptr_f64.var, align 8, !dbg !17
  93. // CHECK:STDOUT: %A.call.loc80 = call ptr @_CA.Main.e8193710fd35b608(ptr %.loc80_5, i32 0), !dbg !18
  94. // CHECK:STDOUT: ret void, !dbg !19
  95. // CHECK:STDOUT: }
  96. // CHECK:STDOUT:
  97. // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
  98. // CHECK:STDOUT: declare void @llvm.lifetime.start.p0(i64 immarg, ptr captures(none)) #0
  99. // CHECK:STDOUT:
  100. // CHECK:STDOUT: define linkonce_odr i32 @_CA.Main.b88d1103f417c6d4(i32 %x, i32 %count) !dbg !20 {
  101. // CHECK:STDOUT: entry:
  102. // CHECK:STDOUT: call void @_CB.Main.b88d1103f417c6d4(i32 %x, i32 %count), !dbg !21
  103. // CHECK:STDOUT: %D.call = call i32 @_CD.Main.b88d1103f417c6d4(i32 %x, i32 %count), !dbg !22
  104. // CHECK:STDOUT: ret i32 %D.call, !dbg !23
  105. // CHECK:STDOUT: }
  106. // CHECK:STDOUT:
  107. // CHECK:STDOUT: define linkonce_odr double @_CA.Main.66be507887ceee78(double %x, i32 %count) !dbg !24 {
  108. // CHECK:STDOUT: entry:
  109. // CHECK:STDOUT: call void @_CB.Main.66be507887ceee78(double %x, i32 %count), !dbg !25
  110. // CHECK:STDOUT: %D.call = call double @_CD.Main.66be507887ceee78(double %x, i32 %count), !dbg !26
  111. // CHECK:STDOUT: ret double %D.call, !dbg !27
  112. // CHECK:STDOUT: }
  113. // CHECK:STDOUT:
  114. // CHECK:STDOUT: define linkonce_odr ptr @_CA.Main.e8193710fd35b608(ptr %x, i32 %count) !dbg !28 {
  115. // CHECK:STDOUT: entry:
  116. // CHECK:STDOUT: call void @_CB.Main.e8193710fd35b608(ptr %x, i32 %count), !dbg !29
  117. // CHECK:STDOUT: %D.call = call ptr @_CD.Main.e8193710fd35b608(ptr %x, i32 %count), !dbg !30
  118. // CHECK:STDOUT: ret ptr %D.call, !dbg !31
  119. // CHECK:STDOUT: }
  120. // CHECK:STDOUT:
  121. // CHECK:STDOUT: define linkonce_odr void @_CB.Main.b88d1103f417c6d4(i32 %x, i32 %count) !dbg !32 {
  122. // CHECK:STDOUT: entry:
  123. // CHECK:STDOUT: call void @_CC.Main.b88d1103f417c6d4(i32 %x, i32 %count), !dbg !33
  124. // CHECK:STDOUT: ret void, !dbg !34
  125. // CHECK:STDOUT: }
  126. // CHECK:STDOUT:
  127. // CHECK:STDOUT: define linkonce_odr i32 @_CD.Main.b88d1103f417c6d4(i32 %x, i32 %count) !dbg !35 {
  128. // CHECK:STDOUT: entry:
  129. // CHECK:STDOUT: %int.greater = icmp sgt i32 %count, 4, !dbg !36
  130. // CHECK:STDOUT: br i1 %int.greater, label %if.then.loc46, label %if.else.loc46, !dbg !37
  131. // CHECK:STDOUT:
  132. // CHECK:STDOUT: if.then.loc46: ; preds = %entry
  133. // CHECK:STDOUT: ret i32 %x, !dbg !38
  134. // CHECK:STDOUT:
  135. // CHECK:STDOUT: if.else.loc46: ; preds = %entry
  136. // CHECK:STDOUT: %int.smod = srem i32 %count, 2, !dbg !39
  137. // CHECK:STDOUT: %int.eq = icmp eq i32 %int.smod, 0, !dbg !39
  138. // CHECK:STDOUT: br i1 %int.eq, label %if.then.loc49, label %if.else.loc49, !dbg !40
  139. // CHECK:STDOUT:
  140. // CHECK:STDOUT: if.then.loc49: ; preds = %if.else.loc46
  141. // CHECK:STDOUT: %E.call = call i32 @_CE.Main.b88d1103f417c6d4(i32 %x, i32 %count), !dbg !41
  142. // CHECK:STDOUT: ret i32 %E.call, !dbg !42
  143. // CHECK:STDOUT:
  144. // CHECK:STDOUT: if.else.loc49: ; preds = %if.else.loc46
  145. // CHECK:STDOUT: %F.call = call i32 @_CF.Main.b88d1103f417c6d4(i32 %x, i32 %count), !dbg !43
  146. // CHECK:STDOUT: ret i32 %F.call, !dbg !44
  147. // CHECK:STDOUT: }
  148. // CHECK:STDOUT:
  149. // CHECK:STDOUT: define linkonce_odr void @_CB.Main.66be507887ceee78(double %x, i32 %count) !dbg !45 {
  150. // CHECK:STDOUT: entry:
  151. // CHECK:STDOUT: call void @_CC.Main.66be507887ceee78(double %x, i32 %count), !dbg !46
  152. // CHECK:STDOUT: ret void, !dbg !47
  153. // CHECK:STDOUT: }
  154. // CHECK:STDOUT:
  155. // CHECK:STDOUT: define linkonce_odr double @_CD.Main.66be507887ceee78(double %x, i32 %count) !dbg !48 {
  156. // CHECK:STDOUT: entry:
  157. // CHECK:STDOUT: %int.greater = icmp sgt i32 %count, 4, !dbg !49
  158. // CHECK:STDOUT: br i1 %int.greater, label %if.then.loc46, label %if.else.loc46, !dbg !50
  159. // CHECK:STDOUT:
  160. // CHECK:STDOUT: if.then.loc46: ; preds = %entry
  161. // CHECK:STDOUT: ret double %x, !dbg !51
  162. // CHECK:STDOUT:
  163. // CHECK:STDOUT: if.else.loc46: ; preds = %entry
  164. // CHECK:STDOUT: %int.smod = srem i32 %count, 2, !dbg !52
  165. // CHECK:STDOUT: %int.eq = icmp eq i32 %int.smod, 0, !dbg !52
  166. // CHECK:STDOUT: br i1 %int.eq, label %if.then.loc49, label %if.else.loc49, !dbg !53
  167. // CHECK:STDOUT:
  168. // CHECK:STDOUT: if.then.loc49: ; preds = %if.else.loc46
  169. // CHECK:STDOUT: %E.call = call double @_CE.Main.66be507887ceee78(double %x, i32 %count), !dbg !54
  170. // CHECK:STDOUT: ret double %E.call, !dbg !55
  171. // CHECK:STDOUT:
  172. // CHECK:STDOUT: if.else.loc49: ; preds = %if.else.loc46
  173. // CHECK:STDOUT: %F.call = call double @_CF.Main.66be507887ceee78(double %x, i32 %count), !dbg !56
  174. // CHECK:STDOUT: ret double %F.call, !dbg !57
  175. // CHECK:STDOUT: }
  176. // CHECK:STDOUT:
  177. // CHECK:STDOUT: define linkonce_odr void @_CB.Main.e8193710fd35b608(ptr %x, i32 %count) !dbg !58 {
  178. // CHECK:STDOUT: entry:
  179. // CHECK:STDOUT: call void @_CC.Main.e8193710fd35b608(ptr %x, i32 %count), !dbg !59
  180. // CHECK:STDOUT: ret void, !dbg !60
  181. // CHECK:STDOUT: }
  182. // CHECK:STDOUT:
  183. // CHECK:STDOUT: define linkonce_odr ptr @_CD.Main.e8193710fd35b608(ptr %x, i32 %count) !dbg !61 {
  184. // CHECK:STDOUT: entry:
  185. // CHECK:STDOUT: %int.greater = icmp sgt i32 %count, 4, !dbg !62
  186. // CHECK:STDOUT: br i1 %int.greater, label %if.then.loc46, label %if.else.loc46, !dbg !63
  187. // CHECK:STDOUT:
  188. // CHECK:STDOUT: if.then.loc46: ; preds = %entry
  189. // CHECK:STDOUT: ret ptr %x, !dbg !64
  190. // CHECK:STDOUT:
  191. // CHECK:STDOUT: if.else.loc46: ; preds = %entry
  192. // CHECK:STDOUT: %int.smod = srem i32 %count, 2, !dbg !65
  193. // CHECK:STDOUT: %int.eq = icmp eq i32 %int.smod, 0, !dbg !65
  194. // CHECK:STDOUT: br i1 %int.eq, label %if.then.loc49, label %if.else.loc49, !dbg !66
  195. // CHECK:STDOUT:
  196. // CHECK:STDOUT: if.then.loc49: ; preds = %if.else.loc46
  197. // CHECK:STDOUT: %E.call = call ptr @_CE.Main.e8193710fd35b608(ptr %x, i32 %count), !dbg !67
  198. // CHECK:STDOUT: ret ptr %E.call, !dbg !68
  199. // CHECK:STDOUT:
  200. // CHECK:STDOUT: if.else.loc49: ; preds = %if.else.loc46
  201. // CHECK:STDOUT: %F.call = call ptr @_CF.Main.e8193710fd35b608(ptr %x, i32 %count), !dbg !69
  202. // CHECK:STDOUT: ret ptr %F.call, !dbg !70
  203. // CHECK:STDOUT: }
  204. // CHECK:STDOUT:
  205. // CHECK:STDOUT: define linkonce_odr void @_CC.Main.b88d1103f417c6d4(i32 %x, i32 %count) !dbg !71 {
  206. // CHECK:STDOUT: entry:
  207. // CHECK:STDOUT: %int.less_eq = icmp sle i32 %count, 2, !dbg !72
  208. // CHECK:STDOUT: br i1 %int.less_eq, label %if.then, label %if.else, !dbg !73
  209. // CHECK:STDOUT:
  210. // CHECK:STDOUT: if.then: ; preds = %entry
  211. // CHECK:STDOUT: %print.int = call i32 (ptr, ...) @printf(ptr @printf.int.format, i32 %count), !dbg !74
  212. // CHECK:STDOUT: %int.sadd = add i32 %count, 1, !dbg !75
  213. // CHECK:STDOUT: call void @_CB.Main.b88d1103f417c6d4(i32 %x, i32 %int.sadd), !dbg !76
  214. // CHECK:STDOUT: br label %if.else, !dbg !77
  215. // CHECK:STDOUT:
  216. // CHECK:STDOUT: if.else: ; preds = %if.then, %entry
  217. // CHECK:STDOUT: ret void, !dbg !78
  218. // CHECK:STDOUT: }
  219. // CHECK:STDOUT:
  220. // CHECK:STDOUT: define linkonce_odr i32 @_CE.Main.b88d1103f417c6d4(i32 %x, i32 %count) !dbg !79 {
  221. // CHECK:STDOUT: entry:
  222. // CHECK:STDOUT: %G.call = call i32 @_CG.Main.b88d1103f417c6d4(i32 %x, i32 %count), !dbg !80
  223. // CHECK:STDOUT: ret i32 %G.call, !dbg !81
  224. // CHECK:STDOUT: }
  225. // CHECK:STDOUT:
  226. // CHECK:STDOUT: define linkonce_odr i32 @_CF.Main.b88d1103f417c6d4(i32 %x, i32 %count) !dbg !82 {
  227. // CHECK:STDOUT: entry:
  228. // CHECK:STDOUT: %G.call = call i32 @_CG.Main.b88d1103f417c6d4(i32 %x, i32 %count), !dbg !83
  229. // CHECK:STDOUT: ret i32 %G.call, !dbg !84
  230. // CHECK:STDOUT: }
  231. // CHECK:STDOUT:
  232. // CHECK:STDOUT: define linkonce_odr void @_CC.Main.66be507887ceee78(double %x, i32 %count) !dbg !85 {
  233. // CHECK:STDOUT: entry:
  234. // CHECK:STDOUT: %int.less_eq = icmp sle i32 %count, 2, !dbg !86
  235. // CHECK:STDOUT: br i1 %int.less_eq, label %if.then, label %if.else, !dbg !87
  236. // CHECK:STDOUT:
  237. // CHECK:STDOUT: if.then: ; preds = %entry
  238. // CHECK:STDOUT: %print.int = call i32 (ptr, ...) @printf(ptr @printf.int.format, i32 %count), !dbg !88
  239. // CHECK:STDOUT: %int.sadd = add i32 %count, 1, !dbg !89
  240. // CHECK:STDOUT: call void @_CB.Main.66be507887ceee78(double %x, i32 %int.sadd), !dbg !90
  241. // CHECK:STDOUT: br label %if.else, !dbg !91
  242. // CHECK:STDOUT:
  243. // CHECK:STDOUT: if.else: ; preds = %if.then, %entry
  244. // CHECK:STDOUT: ret void, !dbg !92
  245. // CHECK:STDOUT: }
  246. // CHECK:STDOUT:
  247. // CHECK:STDOUT: define linkonce_odr double @_CE.Main.66be507887ceee78(double %x, i32 %count) !dbg !93 {
  248. // CHECK:STDOUT: entry:
  249. // CHECK:STDOUT: %G.call = call double @_CG.Main.66be507887ceee78(double %x, i32 %count), !dbg !94
  250. // CHECK:STDOUT: ret double %G.call, !dbg !95
  251. // CHECK:STDOUT: }
  252. // CHECK:STDOUT:
  253. // CHECK:STDOUT: define linkonce_odr double @_CF.Main.66be507887ceee78(double %x, i32 %count) !dbg !96 {
  254. // CHECK:STDOUT: entry:
  255. // CHECK:STDOUT: %G.call = call double @_CG.Main.66be507887ceee78(double %x, i32 %count), !dbg !97
  256. // CHECK:STDOUT: ret double %G.call, !dbg !98
  257. // CHECK:STDOUT: }
  258. // CHECK:STDOUT:
  259. // CHECK:STDOUT: define linkonce_odr void @_CC.Main.e8193710fd35b608(ptr %x, i32 %count) !dbg !99 {
  260. // CHECK:STDOUT: entry:
  261. // CHECK:STDOUT: %int.less_eq = icmp sle i32 %count, 2, !dbg !100
  262. // CHECK:STDOUT: br i1 %int.less_eq, label %if.then, label %if.else, !dbg !101
  263. // CHECK:STDOUT:
  264. // CHECK:STDOUT: if.then: ; preds = %entry
  265. // CHECK:STDOUT: %print.int = call i32 (ptr, ...) @printf(ptr @printf.int.format, i32 %count), !dbg !102
  266. // CHECK:STDOUT: %int.sadd = add i32 %count, 1, !dbg !103
  267. // CHECK:STDOUT: call void @_CB.Main.e8193710fd35b608(ptr %x, i32 %int.sadd), !dbg !104
  268. // CHECK:STDOUT: br label %if.else, !dbg !105
  269. // CHECK:STDOUT:
  270. // CHECK:STDOUT: if.else: ; preds = %if.then, %entry
  271. // CHECK:STDOUT: ret void, !dbg !106
  272. // CHECK:STDOUT: }
  273. // CHECK:STDOUT:
  274. // CHECK:STDOUT: define linkonce_odr ptr @_CE.Main.e8193710fd35b608(ptr %x, i32 %count) !dbg !107 {
  275. // CHECK:STDOUT: entry:
  276. // CHECK:STDOUT: %G.call = call ptr @_CG.Main.e8193710fd35b608(ptr %x, i32 %count), !dbg !108
  277. // CHECK:STDOUT: ret ptr %G.call, !dbg !109
  278. // CHECK:STDOUT: }
  279. // CHECK:STDOUT:
  280. // CHECK:STDOUT: define linkonce_odr ptr @_CF.Main.e8193710fd35b608(ptr %x, i32 %count) !dbg !110 {
  281. // CHECK:STDOUT: entry:
  282. // CHECK:STDOUT: %G.call = call ptr @_CG.Main.e8193710fd35b608(ptr %x, i32 %count), !dbg !111
  283. // CHECK:STDOUT: ret ptr %G.call, !dbg !112
  284. // CHECK:STDOUT: }
  285. // CHECK:STDOUT:
  286. // CHECK:STDOUT: declare i32 @printf(ptr, ...)
  287. // CHECK:STDOUT:
  288. // CHECK:STDOUT: define linkonce_odr i32 @_CG.Main.b88d1103f417c6d4(i32 %x, i32 %count) !dbg !113 {
  289. // CHECK:STDOUT: entry:
  290. // CHECK:STDOUT: %int.sadd = add i32 %count, 1, !dbg !114
  291. // CHECK:STDOUT: %D.call = call i32 @_CD.Main.b88d1103f417c6d4(i32 %x, i32 %int.sadd), !dbg !115
  292. // CHECK:STDOUT: ret i32 %D.call, !dbg !116
  293. // CHECK:STDOUT: }
  294. // CHECK:STDOUT:
  295. // CHECK:STDOUT: define linkonce_odr double @_CG.Main.66be507887ceee78(double %x, i32 %count) !dbg !117 {
  296. // CHECK:STDOUT: entry:
  297. // CHECK:STDOUT: %int.sadd = add i32 %count, 1, !dbg !118
  298. // CHECK:STDOUT: %D.call = call double @_CD.Main.66be507887ceee78(double %x, i32 %int.sadd), !dbg !119
  299. // CHECK:STDOUT: ret double %D.call, !dbg !120
  300. // CHECK:STDOUT: }
  301. // CHECK:STDOUT:
  302. // CHECK:STDOUT: define linkonce_odr ptr @_CG.Main.e8193710fd35b608(ptr %x, i32 %count) !dbg !121 {
  303. // CHECK:STDOUT: entry:
  304. // CHECK:STDOUT: %int.sadd = add i32 %count, 1, !dbg !122
  305. // CHECK:STDOUT: %D.call = call ptr @_CD.Main.e8193710fd35b608(ptr %x, i32 %int.sadd), !dbg !123
  306. // CHECK:STDOUT: ret ptr %D.call, !dbg !124
  307. // CHECK:STDOUT: }
  308. // CHECK:STDOUT:
  309. // CHECK:STDOUT: ; uselistorder directives
  310. // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 3, 2, 1, 0 }
  311. // CHECK:STDOUT: uselistorder ptr @_CA.Main.e8193710fd35b608, { 1, 0 }
  312. // CHECK:STDOUT: uselistorder ptr @printf, { 2, 1, 0 }
  313. // CHECK:STDOUT: uselistorder ptr @_CG.Main.b88d1103f417c6d4, { 1, 0 }
  314. // CHECK:STDOUT: uselistorder ptr @_CG.Main.66be507887ceee78, { 1, 0 }
  315. // CHECK:STDOUT: uselistorder ptr @_CG.Main.e8193710fd35b608, { 1, 0 }
  316. // CHECK:STDOUT:
  317. // CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
  318. // CHECK:STDOUT:
  319. // CHECK:STDOUT: !llvm.module.flags = !{!0, !1}
  320. // CHECK:STDOUT: !llvm.dbg.cu = !{!2}
  321. // CHECK:STDOUT:
  322. // CHECK:STDOUT: !0 = !{i32 7, !"Dwarf Version", i32 5}
  323. // CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3}
  324. // CHECK:STDOUT: !2 = distinct !DICompileUnit(language: DW_LANG_C, file: !3, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug)
  325. // CHECK:STDOUT: !3 = !DIFile(filename: "call_recursive_sccs_deep.carbon", directory: "")
  326. // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "M", linkageName: "_CM.Main", scope: null, file: !3, line: 71, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  327. // CHECK:STDOUT: !5 = !DISubroutineType(types: !6)
  328. // CHECK:STDOUT: !6 = !{}
  329. // CHECK:STDOUT: !7 = !DILocation(line: 72, column: 3, scope: !4)
  330. // CHECK:STDOUT: !8 = !DILocation(line: 73, column: 3, scope: !4)
  331. // CHECK:STDOUT: !9 = !DILocation(line: 74, column: 3, scope: !4)
  332. // CHECK:STDOUT: !10 = !DILocation(line: 75, column: 3, scope: !4)
  333. // CHECK:STDOUT: !11 = !DILocation(line: 77, column: 5, scope: !4)
  334. // CHECK:STDOUT: !12 = !DILocation(line: 77, column: 3, scope: !4)
  335. // CHECK:STDOUT: !13 = !DILocation(line: 78, column: 5, scope: !4)
  336. // CHECK:STDOUT: !14 = !DILocation(line: 78, column: 3, scope: !4)
  337. // CHECK:STDOUT: !15 = !DILocation(line: 79, column: 5, scope: !4)
  338. // CHECK:STDOUT: !16 = !DILocation(line: 79, column: 3, scope: !4)
  339. // CHECK:STDOUT: !17 = !DILocation(line: 80, column: 5, scope: !4)
  340. // CHECK:STDOUT: !18 = !DILocation(line: 80, column: 3, scope: !4)
  341. // CHECK:STDOUT: !19 = !DILocation(line: 71, column: 1, scope: !4)
  342. // CHECK:STDOUT: !20 = distinct !DISubprogram(name: "A", linkageName: "_CA.Main.b88d1103f417c6d4", scope: null, file: !3, line: 29, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  343. // CHECK:STDOUT: !21 = !DILocation(line: 30, column: 3, scope: !20)
  344. // CHECK:STDOUT: !22 = !DILocation(line: 31, column: 10, scope: !20)
  345. // CHECK:STDOUT: !23 = !DILocation(line: 31, column: 3, scope: !20)
  346. // CHECK:STDOUT: !24 = distinct !DISubprogram(name: "A", linkageName: "_CA.Main.66be507887ceee78", scope: null, file: !3, line: 29, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  347. // CHECK:STDOUT: !25 = !DILocation(line: 30, column: 3, scope: !24)
  348. // CHECK:STDOUT: !26 = !DILocation(line: 31, column: 10, scope: !24)
  349. // CHECK:STDOUT: !27 = !DILocation(line: 31, column: 3, scope: !24)
  350. // CHECK:STDOUT: !28 = distinct !DISubprogram(name: "A", linkageName: "_CA.Main.e8193710fd35b608", scope: null, file: !3, line: 29, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  351. // CHECK:STDOUT: !29 = !DILocation(line: 30, column: 3, scope: !28)
  352. // CHECK:STDOUT: !30 = !DILocation(line: 31, column: 10, scope: !28)
  353. // CHECK:STDOUT: !31 = !DILocation(line: 31, column: 3, scope: !28)
  354. // CHECK:STDOUT: !32 = distinct !DISubprogram(name: "B", linkageName: "_CB.Main.b88d1103f417c6d4", scope: null, file: !3, line: 34, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  355. // CHECK:STDOUT: !33 = !DILocation(line: 35, column: 3, scope: !32)
  356. // CHECK:STDOUT: !34 = !DILocation(line: 34, column: 1, scope: !32)
  357. // CHECK:STDOUT: !35 = distinct !DISubprogram(name: "D", linkageName: "_CD.Main.b88d1103f417c6d4", scope: null, file: !3, line: 45, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  358. // CHECK:STDOUT: !36 = !DILocation(line: 46, column: 7, scope: !35)
  359. // CHECK:STDOUT: !37 = !DILocation(line: 46, column: 6, scope: !35)
  360. // CHECK:STDOUT: !38 = !DILocation(line: 47, column: 5, scope: !35)
  361. // CHECK:STDOUT: !39 = !DILocation(line: 49, column: 7, scope: !35)
  362. // CHECK:STDOUT: !40 = !DILocation(line: 49, column: 6, scope: !35)
  363. // CHECK:STDOUT: !41 = !DILocation(line: 50, column: 12, scope: !35)
  364. // CHECK:STDOUT: !42 = !DILocation(line: 50, column: 5, scope: !35)
  365. // CHECK:STDOUT: !43 = !DILocation(line: 52, column: 12, scope: !35)
  366. // CHECK:STDOUT: !44 = !DILocation(line: 52, column: 5, scope: !35)
  367. // CHECK:STDOUT: !45 = distinct !DISubprogram(name: "B", linkageName: "_CB.Main.66be507887ceee78", scope: null, file: !3, line: 34, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  368. // CHECK:STDOUT: !46 = !DILocation(line: 35, column: 3, scope: !45)
  369. // CHECK:STDOUT: !47 = !DILocation(line: 34, column: 1, scope: !45)
  370. // CHECK:STDOUT: !48 = distinct !DISubprogram(name: "D", linkageName: "_CD.Main.66be507887ceee78", scope: null, file: !3, line: 45, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  371. // CHECK:STDOUT: !49 = !DILocation(line: 46, column: 7, scope: !48)
  372. // CHECK:STDOUT: !50 = !DILocation(line: 46, column: 6, scope: !48)
  373. // CHECK:STDOUT: !51 = !DILocation(line: 47, column: 5, scope: !48)
  374. // CHECK:STDOUT: !52 = !DILocation(line: 49, column: 7, scope: !48)
  375. // CHECK:STDOUT: !53 = !DILocation(line: 49, column: 6, scope: !48)
  376. // CHECK:STDOUT: !54 = !DILocation(line: 50, column: 12, scope: !48)
  377. // CHECK:STDOUT: !55 = !DILocation(line: 50, column: 5, scope: !48)
  378. // CHECK:STDOUT: !56 = !DILocation(line: 52, column: 12, scope: !48)
  379. // CHECK:STDOUT: !57 = !DILocation(line: 52, column: 5, scope: !48)
  380. // CHECK:STDOUT: !58 = distinct !DISubprogram(name: "B", linkageName: "_CB.Main.e8193710fd35b608", scope: null, file: !3, line: 34, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  381. // CHECK:STDOUT: !59 = !DILocation(line: 35, column: 3, scope: !58)
  382. // CHECK:STDOUT: !60 = !DILocation(line: 34, column: 1, scope: !58)
  383. // CHECK:STDOUT: !61 = distinct !DISubprogram(name: "D", linkageName: "_CD.Main.e8193710fd35b608", scope: null, file: !3, line: 45, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  384. // CHECK:STDOUT: !62 = !DILocation(line: 46, column: 7, scope: !61)
  385. // CHECK:STDOUT: !63 = !DILocation(line: 46, column: 6, scope: !61)
  386. // CHECK:STDOUT: !64 = !DILocation(line: 47, column: 5, scope: !61)
  387. // CHECK:STDOUT: !65 = !DILocation(line: 49, column: 7, scope: !61)
  388. // CHECK:STDOUT: !66 = !DILocation(line: 49, column: 6, scope: !61)
  389. // CHECK:STDOUT: !67 = !DILocation(line: 50, column: 12, scope: !61)
  390. // CHECK:STDOUT: !68 = !DILocation(line: 50, column: 5, scope: !61)
  391. // CHECK:STDOUT: !69 = !DILocation(line: 52, column: 12, scope: !61)
  392. // CHECK:STDOUT: !70 = !DILocation(line: 52, column: 5, scope: !61)
  393. // CHECK:STDOUT: !71 = distinct !DISubprogram(name: "C", linkageName: "_CC.Main.b88d1103f417c6d4", scope: null, file: !3, line: 38, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  394. // CHECK:STDOUT: !72 = !DILocation(line: 39, column: 7, scope: !71)
  395. // CHECK:STDOUT: !73 = !DILocation(line: 39, column: 6, scope: !71)
  396. // CHECK:STDOUT: !74 = !DILocation(line: 40, column: 5, scope: !71)
  397. // CHECK:STDOUT: !75 = !DILocation(line: 41, column: 10, scope: !71)
  398. // CHECK:STDOUT: !76 = !DILocation(line: 41, column: 5, scope: !71)
  399. // CHECK:STDOUT: !77 = !DILocation(line: 39, column: 3, scope: !71)
  400. // CHECK:STDOUT: !78 = !DILocation(line: 38, column: 1, scope: !71)
  401. // CHECK:STDOUT: !79 = distinct !DISubprogram(name: "E", linkageName: "_CE.Main.b88d1103f417c6d4", scope: null, file: !3, line: 58, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  402. // CHECK:STDOUT: !80 = !DILocation(line: 59, column: 10, scope: !79)
  403. // CHECK:STDOUT: !81 = !DILocation(line: 59, column: 3, scope: !79)
  404. // CHECK:STDOUT: !82 = distinct !DISubprogram(name: "F", linkageName: "_CF.Main.b88d1103f417c6d4", scope: null, file: !3, line: 62, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  405. // CHECK:STDOUT: !83 = !DILocation(line: 63, column: 10, scope: !82)
  406. // CHECK:STDOUT: !84 = !DILocation(line: 63, column: 3, scope: !82)
  407. // CHECK:STDOUT: !85 = distinct !DISubprogram(name: "C", linkageName: "_CC.Main.66be507887ceee78", scope: null, file: !3, line: 38, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  408. // CHECK:STDOUT: !86 = !DILocation(line: 39, column: 7, scope: !85)
  409. // CHECK:STDOUT: !87 = !DILocation(line: 39, column: 6, scope: !85)
  410. // CHECK:STDOUT: !88 = !DILocation(line: 40, column: 5, scope: !85)
  411. // CHECK:STDOUT: !89 = !DILocation(line: 41, column: 10, scope: !85)
  412. // CHECK:STDOUT: !90 = !DILocation(line: 41, column: 5, scope: !85)
  413. // CHECK:STDOUT: !91 = !DILocation(line: 39, column: 3, scope: !85)
  414. // CHECK:STDOUT: !92 = !DILocation(line: 38, column: 1, scope: !85)
  415. // CHECK:STDOUT: !93 = distinct !DISubprogram(name: "E", linkageName: "_CE.Main.66be507887ceee78", scope: null, file: !3, line: 58, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  416. // CHECK:STDOUT: !94 = !DILocation(line: 59, column: 10, scope: !93)
  417. // CHECK:STDOUT: !95 = !DILocation(line: 59, column: 3, scope: !93)
  418. // CHECK:STDOUT: !96 = distinct !DISubprogram(name: "F", linkageName: "_CF.Main.66be507887ceee78", scope: null, file: !3, line: 62, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  419. // CHECK:STDOUT: !97 = !DILocation(line: 63, column: 10, scope: !96)
  420. // CHECK:STDOUT: !98 = !DILocation(line: 63, column: 3, scope: !96)
  421. // CHECK:STDOUT: !99 = distinct !DISubprogram(name: "C", linkageName: "_CC.Main.e8193710fd35b608", scope: null, file: !3, line: 38, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  422. // CHECK:STDOUT: !100 = !DILocation(line: 39, column: 7, scope: !99)
  423. // CHECK:STDOUT: !101 = !DILocation(line: 39, column: 6, scope: !99)
  424. // CHECK:STDOUT: !102 = !DILocation(line: 40, column: 5, scope: !99)
  425. // CHECK:STDOUT: !103 = !DILocation(line: 41, column: 10, scope: !99)
  426. // CHECK:STDOUT: !104 = !DILocation(line: 41, column: 5, scope: !99)
  427. // CHECK:STDOUT: !105 = !DILocation(line: 39, column: 3, scope: !99)
  428. // CHECK:STDOUT: !106 = !DILocation(line: 38, column: 1, scope: !99)
  429. // CHECK:STDOUT: !107 = distinct !DISubprogram(name: "E", linkageName: "_CE.Main.e8193710fd35b608", scope: null, file: !3, line: 58, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  430. // CHECK:STDOUT: !108 = !DILocation(line: 59, column: 10, scope: !107)
  431. // CHECK:STDOUT: !109 = !DILocation(line: 59, column: 3, scope: !107)
  432. // CHECK:STDOUT: !110 = distinct !DISubprogram(name: "F", linkageName: "_CF.Main.e8193710fd35b608", scope: null, file: !3, line: 62, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  433. // CHECK:STDOUT: !111 = !DILocation(line: 63, column: 10, scope: !110)
  434. // CHECK:STDOUT: !112 = !DILocation(line: 63, column: 3, scope: !110)
  435. // CHECK:STDOUT: !113 = distinct !DISubprogram(name: "G", linkageName: "_CG.Main.b88d1103f417c6d4", scope: null, file: !3, line: 66, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  436. // CHECK:STDOUT: !114 = !DILocation(line: 67, column: 15, scope: !113)
  437. // CHECK:STDOUT: !115 = !DILocation(line: 67, column: 10, scope: !113)
  438. // CHECK:STDOUT: !116 = !DILocation(line: 67, column: 3, scope: !113)
  439. // CHECK:STDOUT: !117 = distinct !DISubprogram(name: "G", linkageName: "_CG.Main.66be507887ceee78", scope: null, file: !3, line: 66, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  440. // CHECK:STDOUT: !118 = !DILocation(line: 67, column: 15, scope: !117)
  441. // CHECK:STDOUT: !119 = !DILocation(line: 67, column: 10, scope: !117)
  442. // CHECK:STDOUT: !120 = !DILocation(line: 67, column: 3, scope: !117)
  443. // CHECK:STDOUT: !121 = distinct !DISubprogram(name: "G", linkageName: "_CG.Main.e8193710fd35b608", scope: null, file: !3, line: 66, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  444. // CHECK:STDOUT: !122 = !DILocation(line: 67, column: 15, scope: !121)
  445. // CHECK:STDOUT: !123 = !DILocation(line: 67, column: 10, scope: !121)
  446. // CHECK:STDOUT: !124 = !DILocation(line: 67, column: 3, scope: !121)