reference.carbon 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598
  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/interop/cpp/reference.carbon
  10. // TIP: To dump output, run:
  11. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/interop/cpp/reference.carbon
  12. // ============================================================================
  13. // Reference params
  14. // ============================================================================
  15. // --- pass_references.carbon
  16. library "[[@TEST_NAME]]";
  17. import Cpp inline '''
  18. class C {};
  19. auto TakeCRef(C&) -> void;
  20. auto TakeCRRef(C&&) -> void;
  21. auto TakeConstCRef(const C&) -> void;
  22. auto TakeIntRef(int&) -> void;
  23. auto TakeIntRRef(int&&) -> void;
  24. auto TakeConstIntRef(const int&) -> void;
  25. ''';
  26. fn PassRefs() {
  27. var c: Cpp.C;
  28. Cpp.TakeCRef(ref c);
  29. Cpp.TakeCRRef({} as Cpp.C);
  30. Cpp.TakeConstCRef(c);
  31. var n: i32;
  32. Cpp.TakeIntRef(ref n);
  33. Cpp.TakeIntRRef(42 as i32);
  34. Cpp.TakeConstIntRef(n);
  35. }
  36. // --- pass_references_via_thunk.carbon
  37. library "[[@TEST_NAME]]";
  38. import Cpp inline '''
  39. class C {};
  40. class ForceThunk {};
  41. auto TakeCRef(C&, ForceThunk = {}) -> void;
  42. auto TakeCRRef(const C&, ForceThunk = {}) -> void;
  43. auto TakeConstCRef(const C&, ForceThunk = {}) -> void;
  44. auto TakeIntRef(int&, ForceThunk = {}) -> void;
  45. auto TakeIntRRef(int&&, ForceThunk = {}) -> void;
  46. auto TakeConstIntRef(const int&, ForceThunk = {}) -> void;
  47. ''';
  48. fn PassRefs() {
  49. var c: Cpp.C;
  50. Cpp.TakeCRef(ref c);
  51. Cpp.TakeCRRef({} as Cpp.C);
  52. Cpp.TakeConstCRef(c);
  53. var n: i32;
  54. Cpp.TakeIntRef(ref n);
  55. Cpp.TakeIntRRef(42 as i32);
  56. Cpp.TakeConstIntRef(n);
  57. }
  58. // ============================================================================
  59. // Reference return values
  60. // ============================================================================
  61. // --- return_references.carbon
  62. library "[[@TEST_NAME]]";
  63. import Cpp inline '''
  64. class C {};
  65. auto ReturnCRef() -> C&;
  66. auto ReturnCRRef() -> C&&;
  67. auto ReturnConstCRef() -> const C&;
  68. auto ReturnIntRef() -> int&;
  69. auto ReturnIntRRef() -> int&&;
  70. auto ReturnConstIntRef() -> const int&;
  71. ''';
  72. fn GetRefs() {
  73. let ref _: Cpp.C = Cpp.ReturnCRef();
  74. let ref _: Cpp.C = Cpp.ReturnCRRef();
  75. let ref _: const Cpp.C = Cpp.ReturnConstCRef();
  76. let ref _: i32 = Cpp.ReturnIntRef();
  77. let ref _: i32 = Cpp.ReturnIntRRef();
  78. let ref _: const i32 = Cpp.ReturnConstIntRef();
  79. }
  80. // --- return_references_via_thunk.carbon
  81. library "[[@TEST_NAME]]";
  82. import Cpp inline '''
  83. class C {};
  84. class ForceThunk {};
  85. auto ReturnCRef(ForceThunk = {}) -> C&;
  86. auto ReturnCRRef(ForceThunk = {}) -> C&&;
  87. auto ReturnConstCRef(ForceThunk = {}) -> const C&;
  88. auto ReturnIntRef(ForceThunk = {}) -> int&;
  89. auto ReturnIntRRef(ForceThunk = {}) -> int&&;
  90. auto ReturnConstIntRef(ForceThunk = {}) -> const int&;
  91. ''';
  92. fn GetRefs() {
  93. let ref _: Cpp.C = Cpp.ReturnCRef();
  94. let ref _: Cpp.C = Cpp.ReturnCRRef();
  95. let ref _: const Cpp.C = Cpp.ReturnConstCRef();
  96. let ref _: i32 = Cpp.ReturnIntRef();
  97. let ref _: i32 = Cpp.ReturnIntRRef();
  98. let ref _: const i32 = Cpp.ReturnConstIntRef();
  99. }
  100. // CHECK:STDOUT: ; ModuleID = 'pass_references.carbon'
  101. // CHECK:STDOUT: source_filename = "pass_references.carbon"
  102. // CHECK:STDOUT: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
  103. // CHECK:STDOUT: target triple = "x86_64-unknown-linux-gnu"
  104. // CHECK:STDOUT:
  105. // CHECK:STDOUT: @C.val.loc19_18.3 = internal constant {} zeroinitializer
  106. // CHECK:STDOUT:
  107. // CHECK:STDOUT: ; Function Attrs: nounwind
  108. // CHECK:STDOUT: define void @_CPassRefs.Main() #0 !dbg !12 {
  109. // CHECK:STDOUT: entry:
  110. // CHECK:STDOUT: %c.var = alloca {}, align 8, !dbg !15
  111. // CHECK:STDOUT: %.loc19_18.2.temp = alloca {}, align 8, !dbg !16
  112. // CHECK:STDOUT: %n.var = alloca i32, align 4, !dbg !17
  113. // CHECK:STDOUT: %.loc24_22.3.temp = alloca i32, align 4, !dbg !18
  114. // CHECK:STDOUT: %.loc25_23.2.temp = alloca i32, align 4, !dbg !19
  115. // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %c.var), !dbg !15
  116. // CHECK:STDOUT: call void @_Z8TakeCRefR1C(ptr %c.var), !dbg !20
  117. // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc19_18.2.temp), !dbg !16
  118. // CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 1 %.loc19_18.2.temp, ptr align 1 @C.val.loc19_18.3, i64 0, i1 false), !dbg !16
  119. // CHECK:STDOUT: call void @_Z9TakeCRRefO1C.carbon_thunk(ptr %.loc19_18.2.temp), !dbg !21
  120. // CHECK:STDOUT: call void @_Z13TakeConstCRefRK1C.carbon_thunk(ptr %c.var), !dbg !22
  121. // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %n.var), !dbg !17
  122. // CHECK:STDOUT: call void @_Z10TakeIntRefRi(ptr %n.var), !dbg !23
  123. // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc24_22.3.temp), !dbg !18
  124. // CHECK:STDOUT: store i32 42, ptr %.loc24_22.3.temp, align 4, !dbg !18
  125. // CHECK:STDOUT: call void @_Z11TakeIntRRefOi.carbon_thunk(ptr %.loc24_22.3.temp), !dbg !24
  126. // CHECK:STDOUT: %.loc25_23.1 = load i32, ptr %n.var, align 4, !dbg !19
  127. // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc25_23.2.temp), !dbg !19
  128. // CHECK:STDOUT: store i32 %.loc25_23.1, ptr %.loc25_23.2.temp, align 4, !dbg !19
  129. // CHECK:STDOUT: call void @_Z15TakeConstIntRefRKi.carbon_thunk(ptr %.loc25_23.2.temp), !dbg !25
  130. // CHECK:STDOUT: ret void, !dbg !26
  131. // CHECK:STDOUT: }
  132. // CHECK:STDOUT:
  133. // CHECK:STDOUT: declare void @_Z8TakeCRefR1C(ptr)
  134. // CHECK:STDOUT:
  135. // CHECK:STDOUT: declare void @_Z10TakeIntRefRi(ptr)
  136. // CHECK:STDOUT:
  137. // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
  138. // CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1
  139. // CHECK:STDOUT:
  140. // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
  141. // CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #2
  142. // CHECK:STDOUT:
  143. // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable
  144. // CHECK:STDOUT: define dso_local void @_Z9TakeCRRefO1C.carbon_thunk(ptr noundef %0) #3 {
  145. // CHECK:STDOUT: entry:
  146. // CHECK:STDOUT: %.addr = alloca ptr, align 8
  147. // CHECK:STDOUT: store ptr %0, ptr %.addr, align 8, !tbaa !27
  148. // CHECK:STDOUT: %1 = load ptr, ptr %.addr, align 8, !tbaa !27
  149. // CHECK:STDOUT: call void @_Z9TakeCRRefO1C(ptr noundef nonnull align 1 dereferenceable(1) %1)
  150. // CHECK:STDOUT: ret void
  151. // CHECK:STDOUT: }
  152. // CHECK:STDOUT:
  153. // CHECK:STDOUT: declare void @_Z9TakeCRRefO1C(ptr noundef nonnull align 1 dereferenceable(1)) #4
  154. // CHECK:STDOUT:
  155. // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable
  156. // CHECK:STDOUT: define dso_local void @_Z13TakeConstCRefRK1C.carbon_thunk(ptr noundef %0) #3 {
  157. // CHECK:STDOUT: entry:
  158. // CHECK:STDOUT: %.addr = alloca ptr, align 8
  159. // CHECK:STDOUT: store ptr %0, ptr %.addr, align 8, !tbaa !27
  160. // CHECK:STDOUT: %1 = load ptr, ptr %.addr, align 8, !tbaa !27
  161. // CHECK:STDOUT: call void @_Z13TakeConstCRefRK1C(ptr noundef nonnull align 1 dereferenceable(1) %1)
  162. // CHECK:STDOUT: ret void
  163. // CHECK:STDOUT: }
  164. // CHECK:STDOUT:
  165. // CHECK:STDOUT: declare void @_Z13TakeConstCRefRK1C(ptr noundef nonnull align 1 dereferenceable(1)) #4
  166. // CHECK:STDOUT:
  167. // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable
  168. // CHECK:STDOUT: define dso_local void @_Z11TakeIntRRefOi.carbon_thunk(ptr noundef %0) #3 {
  169. // CHECK:STDOUT: entry:
  170. // CHECK:STDOUT: %.addr = alloca ptr, align 8
  171. // CHECK:STDOUT: store ptr %0, ptr %.addr, align 8, !tbaa !30
  172. // CHECK:STDOUT: %1 = load ptr, ptr %.addr, align 8, !tbaa !30
  173. // CHECK:STDOUT: call void @_Z11TakeIntRRefOi(ptr noundef nonnull align 4 dereferenceable(4) %1)
  174. // CHECK:STDOUT: ret void
  175. // CHECK:STDOUT: }
  176. // CHECK:STDOUT:
  177. // CHECK:STDOUT: declare void @_Z11TakeIntRRefOi(ptr noundef nonnull align 4 dereferenceable(4)) #4
  178. // CHECK:STDOUT:
  179. // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable
  180. // CHECK:STDOUT: define dso_local void @_Z15TakeConstIntRefRKi.carbon_thunk(ptr noundef %0) #3 {
  181. // CHECK:STDOUT: entry:
  182. // CHECK:STDOUT: %.addr = alloca ptr, align 8
  183. // CHECK:STDOUT: store ptr %0, ptr %.addr, align 8, !tbaa !30
  184. // CHECK:STDOUT: %1 = load ptr, ptr %.addr, align 8, !tbaa !30
  185. // CHECK:STDOUT: call void @_Z15TakeConstIntRefRKi(ptr noundef nonnull align 4 dereferenceable(4) %1)
  186. // CHECK:STDOUT: ret void
  187. // CHECK:STDOUT: }
  188. // CHECK:STDOUT:
  189. // CHECK:STDOUT: declare void @_Z15TakeConstIntRefRKi(ptr noundef nonnull align 4 dereferenceable(4)) #4
  190. // CHECK:STDOUT:
  191. // CHECK:STDOUT: ; uselistorder directives
  192. // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 4, 3, 2, 1, 0 }
  193. // CHECK:STDOUT:
  194. // CHECK:STDOUT: attributes #0 = { nounwind }
  195. // CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
  196. // CHECK:STDOUT: attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
  197. // CHECK:STDOUT: attributes #3 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
  198. // CHECK:STDOUT: attributes #4 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
  199. // CHECK:STDOUT:
  200. // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4, !5}
  201. // CHECK:STDOUT: !llvm.dbg.cu = !{!6}
  202. // CHECK:STDOUT: !llvm.errno.tbaa = !{!8}
  203. // CHECK:STDOUT:
  204. // CHECK:STDOUT: !0 = !{i32 7, !"Dwarf Version", i32 5}
  205. // CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3}
  206. // CHECK:STDOUT: !2 = !{i32 1, !"wchar_size", i32 4}
  207. // CHECK:STDOUT: !3 = !{i32 8, !"PIC Level", i32 0}
  208. // CHECK:STDOUT: !4 = !{i32 7, !"PIE Level", i32 2}
  209. // CHECK:STDOUT: !5 = !{i32 7, !"uwtable", i32 2}
  210. // CHECK:STDOUT: !6 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !7, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug)
  211. // CHECK:STDOUT: !7 = !DIFile(filename: "pass_references.carbon", directory: "")
  212. // CHECK:STDOUT: !8 = !{!9, !9, i64 0}
  213. // CHECK:STDOUT: !9 = !{!"int", !10, i64 0}
  214. // CHECK:STDOUT: !10 = !{!"omnipotent char", !11, i64 0}
  215. // CHECK:STDOUT: !11 = !{!"Simple C++ TBAA"}
  216. // CHECK:STDOUT: !12 = distinct !DISubprogram(name: "PassRefs", linkageName: "_CPassRefs.Main", scope: null, file: !7, line: 16, type: !13, spFlags: DISPFlagDefinition, unit: !6)
  217. // CHECK:STDOUT: !13 = !DISubroutineType(types: !14)
  218. // CHECK:STDOUT: !14 = !{null}
  219. // CHECK:STDOUT: !15 = !DILocation(line: 17, column: 3, scope: !12)
  220. // CHECK:STDOUT: !16 = !DILocation(line: 19, column: 17, scope: !12)
  221. // CHECK:STDOUT: !17 = !DILocation(line: 22, column: 3, scope: !12)
  222. // CHECK:STDOUT: !18 = !DILocation(line: 24, column: 19, scope: !12)
  223. // CHECK:STDOUT: !19 = !DILocation(line: 25, column: 23, scope: !12)
  224. // CHECK:STDOUT: !20 = !DILocation(line: 18, column: 3, scope: !12)
  225. // CHECK:STDOUT: !21 = !DILocation(line: 19, column: 3, scope: !12)
  226. // CHECK:STDOUT: !22 = !DILocation(line: 20, column: 3, scope: !12)
  227. // CHECK:STDOUT: !23 = !DILocation(line: 23, column: 3, scope: !12)
  228. // CHECK:STDOUT: !24 = !DILocation(line: 24, column: 3, scope: !12)
  229. // CHECK:STDOUT: !25 = !DILocation(line: 25, column: 3, scope: !12)
  230. // CHECK:STDOUT: !26 = !DILocation(line: 16, column: 1, scope: !12)
  231. // CHECK:STDOUT: !27 = !{!28, !28, i64 0}
  232. // CHECK:STDOUT: !28 = !{!"p1 _ZTS1C", !29, i64 0}
  233. // CHECK:STDOUT: !29 = !{!"any pointer", !10, i64 0}
  234. // CHECK:STDOUT: !30 = !{!31, !31, i64 0}
  235. // CHECK:STDOUT: !31 = !{!"p1 int", !29, i64 0}
  236. // CHECK:STDOUT: ; ModuleID = 'pass_references_via_thunk.carbon'
  237. // CHECK:STDOUT: source_filename = "pass_references_via_thunk.carbon"
  238. // CHECK:STDOUT: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
  239. // CHECK:STDOUT: target triple = "x86_64-unknown-linux-gnu"
  240. // CHECK:STDOUT:
  241. // CHECK:STDOUT: %class.ForceThunk = type { i8 }
  242. // CHECK:STDOUT:
  243. // CHECK:STDOUT: @C.val.loc20_18.3 = internal constant {} zeroinitializer
  244. // CHECK:STDOUT:
  245. // CHECK:STDOUT: ; Function Attrs: nounwind
  246. // CHECK:STDOUT: define void @_CPassRefs.Main() #0 !dbg !12 {
  247. // CHECK:STDOUT: entry:
  248. // CHECK:STDOUT: %c.var = alloca {}, align 8, !dbg !15
  249. // CHECK:STDOUT: %.loc20_18.2.temp = alloca {}, align 8, !dbg !16
  250. // CHECK:STDOUT: %n.var = alloca i32, align 4, !dbg !17
  251. // CHECK:STDOUT: %.loc25_22.3.temp = alloca i32, align 4, !dbg !18
  252. // CHECK:STDOUT: %.loc26_23.2.temp = alloca i32, align 4, !dbg !19
  253. // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %c.var), !dbg !15
  254. // CHECK:STDOUT: call void @_Z8TakeCRefR1C10ForceThunk.carbon_thunk1(ptr %c.var), !dbg !20
  255. // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc20_18.2.temp), !dbg !16
  256. // CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 1 %.loc20_18.2.temp, ptr align 1 @C.val.loc20_18.3, i64 0, i1 false), !dbg !16
  257. // CHECK:STDOUT: call void @_Z9TakeCRRefRK1C10ForceThunk.carbon_thunk1(ptr %.loc20_18.2.temp), !dbg !21
  258. // CHECK:STDOUT: call void @_Z13TakeConstCRefRK1C10ForceThunk.carbon_thunk1(ptr %c.var), !dbg !22
  259. // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %n.var), !dbg !17
  260. // CHECK:STDOUT: call void @_Z10TakeIntRefRi10ForceThunk.carbon_thunk1(ptr %n.var), !dbg !23
  261. // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc25_22.3.temp), !dbg !18
  262. // CHECK:STDOUT: store i32 42, ptr %.loc25_22.3.temp, align 4, !dbg !18
  263. // CHECK:STDOUT: call void @_Z11TakeIntRRefOi10ForceThunk.carbon_thunk1(ptr %.loc25_22.3.temp), !dbg !24
  264. // CHECK:STDOUT: %.loc26_23.1 = load i32, ptr %n.var, align 4, !dbg !19
  265. // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc26_23.2.temp), !dbg !19
  266. // CHECK:STDOUT: store i32 %.loc26_23.1, ptr %.loc26_23.2.temp, align 4, !dbg !19
  267. // CHECK:STDOUT: call void @_Z15TakeConstIntRefRKi10ForceThunk.carbon_thunk1(ptr %.loc26_23.2.temp), !dbg !25
  268. // CHECK:STDOUT: ret void, !dbg !26
  269. // CHECK:STDOUT: }
  270. // CHECK:STDOUT:
  271. // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
  272. // CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1
  273. // CHECK:STDOUT:
  274. // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
  275. // CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #2
  276. // CHECK:STDOUT:
  277. // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable
  278. // CHECK:STDOUT: define dso_local void @_Z8TakeCRefR1C10ForceThunk.carbon_thunk1(ptr noundef nonnull align 1 dereferenceable(1) %0) #3 {
  279. // CHECK:STDOUT: entry:
  280. // CHECK:STDOUT: %.addr = alloca ptr, align 8
  281. // CHECK:STDOUT: %agg.tmp = alloca %class.ForceThunk, align 1
  282. // CHECK:STDOUT: store ptr %0, ptr %.addr, align 8, !tbaa !27
  283. // CHECK:STDOUT: %1 = load ptr, ptr %.addr, align 8, !tbaa !27, !nonnull !30
  284. // CHECK:STDOUT: call void @_Z8TakeCRefR1C10ForceThunk(ptr noundef nonnull align 1 dereferenceable(1) %1)
  285. // CHECK:STDOUT: ret void
  286. // CHECK:STDOUT: }
  287. // CHECK:STDOUT:
  288. // CHECK:STDOUT: declare void @_Z8TakeCRefR1C10ForceThunk(ptr noundef nonnull align 1 dereferenceable(1)) #4
  289. // CHECK:STDOUT:
  290. // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable
  291. // CHECK:STDOUT: define dso_local void @_Z9TakeCRRefRK1C10ForceThunk.carbon_thunk1(ptr noundef %0) #3 {
  292. // CHECK:STDOUT: entry:
  293. // CHECK:STDOUT: %.addr = alloca ptr, align 8
  294. // CHECK:STDOUT: %agg.tmp = alloca %class.ForceThunk, align 1
  295. // CHECK:STDOUT: store ptr %0, ptr %.addr, align 8, !tbaa !27
  296. // CHECK:STDOUT: %1 = load ptr, ptr %.addr, align 8, !tbaa !27
  297. // CHECK:STDOUT: call void @_Z9TakeCRRefRK1C10ForceThunk(ptr noundef nonnull align 1 dereferenceable(1) %1)
  298. // CHECK:STDOUT: ret void
  299. // CHECK:STDOUT: }
  300. // CHECK:STDOUT:
  301. // CHECK:STDOUT: declare void @_Z9TakeCRRefRK1C10ForceThunk(ptr noundef nonnull align 1 dereferenceable(1)) #4
  302. // CHECK:STDOUT:
  303. // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable
  304. // CHECK:STDOUT: define dso_local void @_Z13TakeConstCRefRK1C10ForceThunk.carbon_thunk1(ptr noundef %0) #3 {
  305. // CHECK:STDOUT: entry:
  306. // CHECK:STDOUT: %.addr = alloca ptr, align 8
  307. // CHECK:STDOUT: %agg.tmp = alloca %class.ForceThunk, align 1
  308. // CHECK:STDOUT: store ptr %0, ptr %.addr, align 8, !tbaa !27
  309. // CHECK:STDOUT: %1 = load ptr, ptr %.addr, align 8, !tbaa !27
  310. // CHECK:STDOUT: call void @_Z13TakeConstCRefRK1C10ForceThunk(ptr noundef nonnull align 1 dereferenceable(1) %1)
  311. // CHECK:STDOUT: ret void
  312. // CHECK:STDOUT: }
  313. // CHECK:STDOUT:
  314. // CHECK:STDOUT: declare void @_Z13TakeConstCRefRK1C10ForceThunk(ptr noundef nonnull align 1 dereferenceable(1)) #4
  315. // CHECK:STDOUT:
  316. // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable
  317. // CHECK:STDOUT: define dso_local void @_Z10TakeIntRefRi10ForceThunk.carbon_thunk1(ptr noundef nonnull align 4 dereferenceable(4) %0) #3 {
  318. // CHECK:STDOUT: entry:
  319. // CHECK:STDOUT: %.addr = alloca ptr, align 8
  320. // CHECK:STDOUT: %agg.tmp = alloca %class.ForceThunk, align 1
  321. // CHECK:STDOUT: store ptr %0, ptr %.addr, align 8, !tbaa !31
  322. // CHECK:STDOUT: %1 = load ptr, ptr %.addr, align 8, !tbaa !31, !nonnull !30, !align !33
  323. // CHECK:STDOUT: call void @_Z10TakeIntRefRi10ForceThunk(ptr noundef nonnull align 4 dereferenceable(4) %1)
  324. // CHECK:STDOUT: ret void
  325. // CHECK:STDOUT: }
  326. // CHECK:STDOUT:
  327. // CHECK:STDOUT: declare void @_Z10TakeIntRefRi10ForceThunk(ptr noundef nonnull align 4 dereferenceable(4)) #4
  328. // CHECK:STDOUT:
  329. // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable
  330. // CHECK:STDOUT: define dso_local void @_Z11TakeIntRRefOi10ForceThunk.carbon_thunk1(ptr noundef %0) #3 {
  331. // CHECK:STDOUT: entry:
  332. // CHECK:STDOUT: %.addr = alloca ptr, align 8
  333. // CHECK:STDOUT: %agg.tmp = alloca %class.ForceThunk, align 1
  334. // CHECK:STDOUT: store ptr %0, ptr %.addr, align 8, !tbaa !31
  335. // CHECK:STDOUT: %1 = load ptr, ptr %.addr, align 8, !tbaa !31
  336. // CHECK:STDOUT: call void @_Z11TakeIntRRefOi10ForceThunk(ptr noundef nonnull align 4 dereferenceable(4) %1)
  337. // CHECK:STDOUT: ret void
  338. // CHECK:STDOUT: }
  339. // CHECK:STDOUT:
  340. // CHECK:STDOUT: declare void @_Z11TakeIntRRefOi10ForceThunk(ptr noundef nonnull align 4 dereferenceable(4)) #4
  341. // CHECK:STDOUT:
  342. // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable
  343. // CHECK:STDOUT: define dso_local void @_Z15TakeConstIntRefRKi10ForceThunk.carbon_thunk1(ptr noundef %0) #3 {
  344. // CHECK:STDOUT: entry:
  345. // CHECK:STDOUT: %.addr = alloca ptr, align 8
  346. // CHECK:STDOUT: %agg.tmp = alloca %class.ForceThunk, align 1
  347. // CHECK:STDOUT: store ptr %0, ptr %.addr, align 8, !tbaa !31
  348. // CHECK:STDOUT: %1 = load ptr, ptr %.addr, align 8, !tbaa !31
  349. // CHECK:STDOUT: call void @_Z15TakeConstIntRefRKi10ForceThunk(ptr noundef nonnull align 4 dereferenceable(4) %1)
  350. // CHECK:STDOUT: ret void
  351. // CHECK:STDOUT: }
  352. // CHECK:STDOUT:
  353. // CHECK:STDOUT: declare void @_Z15TakeConstIntRefRKi10ForceThunk(ptr noundef nonnull align 4 dereferenceable(4)) #4
  354. // CHECK:STDOUT:
  355. // CHECK:STDOUT: ; uselistorder directives
  356. // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 4, 3, 2, 1, 0 }
  357. // CHECK:STDOUT:
  358. // CHECK:STDOUT: attributes #0 = { nounwind }
  359. // CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
  360. // CHECK:STDOUT: attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
  361. // CHECK:STDOUT: attributes #3 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
  362. // CHECK:STDOUT: attributes #4 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
  363. // CHECK:STDOUT:
  364. // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4, !5}
  365. // CHECK:STDOUT: !llvm.dbg.cu = !{!6}
  366. // CHECK:STDOUT: !llvm.errno.tbaa = !{!8}
  367. // CHECK:STDOUT:
  368. // CHECK:STDOUT: !0 = !{i32 7, !"Dwarf Version", i32 5}
  369. // CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3}
  370. // CHECK:STDOUT: !2 = !{i32 1, !"wchar_size", i32 4}
  371. // CHECK:STDOUT: !3 = !{i32 8, !"PIC Level", i32 0}
  372. // CHECK:STDOUT: !4 = !{i32 7, !"PIE Level", i32 2}
  373. // CHECK:STDOUT: !5 = !{i32 7, !"uwtable", i32 2}
  374. // CHECK:STDOUT: !6 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !7, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug)
  375. // CHECK:STDOUT: !7 = !DIFile(filename: "pass_references_via_thunk.carbon", directory: "")
  376. // CHECK:STDOUT: !8 = !{!9, !9, i64 0}
  377. // CHECK:STDOUT: !9 = !{!"int", !10, i64 0}
  378. // CHECK:STDOUT: !10 = !{!"omnipotent char", !11, i64 0}
  379. // CHECK:STDOUT: !11 = !{!"Simple C++ TBAA"}
  380. // CHECK:STDOUT: !12 = distinct !DISubprogram(name: "PassRefs", linkageName: "_CPassRefs.Main", scope: null, file: !7, line: 17, type: !13, spFlags: DISPFlagDefinition, unit: !6)
  381. // CHECK:STDOUT: !13 = !DISubroutineType(types: !14)
  382. // CHECK:STDOUT: !14 = !{null}
  383. // CHECK:STDOUT: !15 = !DILocation(line: 18, column: 3, scope: !12)
  384. // CHECK:STDOUT: !16 = !DILocation(line: 20, column: 17, scope: !12)
  385. // CHECK:STDOUT: !17 = !DILocation(line: 23, column: 3, scope: !12)
  386. // CHECK:STDOUT: !18 = !DILocation(line: 25, column: 19, scope: !12)
  387. // CHECK:STDOUT: !19 = !DILocation(line: 26, column: 23, scope: !12)
  388. // CHECK:STDOUT: !20 = !DILocation(line: 19, column: 3, scope: !12)
  389. // CHECK:STDOUT: !21 = !DILocation(line: 20, column: 3, scope: !12)
  390. // CHECK:STDOUT: !22 = !DILocation(line: 21, column: 3, scope: !12)
  391. // CHECK:STDOUT: !23 = !DILocation(line: 24, column: 3, scope: !12)
  392. // CHECK:STDOUT: !24 = !DILocation(line: 25, column: 3, scope: !12)
  393. // CHECK:STDOUT: !25 = !DILocation(line: 26, column: 3, scope: !12)
  394. // CHECK:STDOUT: !26 = !DILocation(line: 17, column: 1, scope: !12)
  395. // CHECK:STDOUT: !27 = !{!28, !28, i64 0}
  396. // CHECK:STDOUT: !28 = !{!"p1 _ZTS1C", !29, i64 0}
  397. // CHECK:STDOUT: !29 = !{!"any pointer", !10, i64 0}
  398. // CHECK:STDOUT: !30 = !{}
  399. // CHECK:STDOUT: !31 = !{!32, !32, i64 0}
  400. // CHECK:STDOUT: !32 = !{!"p1 int", !29, i64 0}
  401. // CHECK:STDOUT: !33 = !{i64 4}
  402. // CHECK:STDOUT: ; ModuleID = 'return_references.carbon'
  403. // CHECK:STDOUT: source_filename = "return_references.carbon"
  404. // CHECK:STDOUT: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
  405. // CHECK:STDOUT: target triple = "x86_64-unknown-linux-gnu"
  406. // CHECK:STDOUT:
  407. // CHECK:STDOUT: ; Function Attrs: nounwind
  408. // CHECK:STDOUT: define void @_CGetRefs.Main() #0 !dbg !12 {
  409. // CHECK:STDOUT: entry:
  410. // CHECK:STDOUT: %ReturnCRef.call = call ptr @_Z10ReturnCRefv(), !dbg !15
  411. // CHECK:STDOUT: %ReturnCRRef.call = call ptr @_Z11ReturnCRRefv(), !dbg !16
  412. // CHECK:STDOUT: %ReturnConstCRef.call = call ptr @_Z15ReturnConstCRefv(), !dbg !17
  413. // CHECK:STDOUT: %ReturnIntRef.call = call ptr @_Z12ReturnIntRefv(), !dbg !18
  414. // CHECK:STDOUT: %ReturnIntRRef.call = call ptr @_Z13ReturnIntRRefv(), !dbg !19
  415. // CHECK:STDOUT: %ReturnConstIntRef.call = call ptr @_Z17ReturnConstIntRefv(), !dbg !20
  416. // CHECK:STDOUT: ret void, !dbg !21
  417. // CHECK:STDOUT: }
  418. // CHECK:STDOUT:
  419. // CHECK:STDOUT: declare ptr @_Z10ReturnCRefv()
  420. // CHECK:STDOUT:
  421. // CHECK:STDOUT: declare ptr @_Z11ReturnCRRefv()
  422. // CHECK:STDOUT:
  423. // CHECK:STDOUT: declare ptr @_Z15ReturnConstCRefv()
  424. // CHECK:STDOUT:
  425. // CHECK:STDOUT: declare ptr @_Z12ReturnIntRefv()
  426. // CHECK:STDOUT:
  427. // CHECK:STDOUT: declare ptr @_Z13ReturnIntRRefv()
  428. // CHECK:STDOUT:
  429. // CHECK:STDOUT: declare ptr @_Z17ReturnConstIntRefv()
  430. // CHECK:STDOUT:
  431. // CHECK:STDOUT: attributes #0 = { nounwind }
  432. // CHECK:STDOUT:
  433. // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4, !5}
  434. // CHECK:STDOUT: !llvm.dbg.cu = !{!6}
  435. // CHECK:STDOUT: !llvm.errno.tbaa = !{!8}
  436. // CHECK:STDOUT:
  437. // CHECK:STDOUT: !0 = !{i32 7, !"Dwarf Version", i32 5}
  438. // CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3}
  439. // CHECK:STDOUT: !2 = !{i32 1, !"wchar_size", i32 4}
  440. // CHECK:STDOUT: !3 = !{i32 8, !"PIC Level", i32 0}
  441. // CHECK:STDOUT: !4 = !{i32 7, !"PIE Level", i32 2}
  442. // CHECK:STDOUT: !5 = !{i32 7, !"uwtable", i32 2}
  443. // CHECK:STDOUT: !6 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !7, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug)
  444. // CHECK:STDOUT: !7 = !DIFile(filename: "return_references.carbon", directory: "")
  445. // CHECK:STDOUT: !8 = !{!9, !9, i64 0}
  446. // CHECK:STDOUT: !9 = !{!"int", !10, i64 0}
  447. // CHECK:STDOUT: !10 = !{!"omnipotent char", !11, i64 0}
  448. // CHECK:STDOUT: !11 = !{!"Simple C++ TBAA"}
  449. // CHECK:STDOUT: !12 = distinct !DISubprogram(name: "GetRefs", linkageName: "_CGetRefs.Main", scope: null, file: !7, line: 16, type: !13, spFlags: DISPFlagDefinition, unit: !6)
  450. // CHECK:STDOUT: !13 = !DISubroutineType(types: !14)
  451. // CHECK:STDOUT: !14 = !{null}
  452. // CHECK:STDOUT: !15 = !DILocation(line: 17, column: 22, scope: !12)
  453. // CHECK:STDOUT: !16 = !DILocation(line: 18, column: 22, scope: !12)
  454. // CHECK:STDOUT: !17 = !DILocation(line: 19, column: 28, scope: !12)
  455. // CHECK:STDOUT: !18 = !DILocation(line: 21, column: 20, scope: !12)
  456. // CHECK:STDOUT: !19 = !DILocation(line: 22, column: 20, scope: !12)
  457. // CHECK:STDOUT: !20 = !DILocation(line: 23, column: 26, scope: !12)
  458. // CHECK:STDOUT: !21 = !DILocation(line: 16, column: 1, scope: !12)
  459. // CHECK:STDOUT: ; ModuleID = 'return_references_via_thunk.carbon'
  460. // CHECK:STDOUT: source_filename = "return_references_via_thunk.carbon"
  461. // CHECK:STDOUT: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
  462. // CHECK:STDOUT: target triple = "x86_64-unknown-linux-gnu"
  463. // CHECK:STDOUT:
  464. // CHECK:STDOUT: %class.ForceThunk = type { i8 }
  465. // CHECK:STDOUT:
  466. // CHECK:STDOUT: ; Function Attrs: nounwind
  467. // CHECK:STDOUT: define void @_CGetRefs.Main() #0 !dbg !12 {
  468. // CHECK:STDOUT: entry:
  469. // CHECK:STDOUT: %ReturnCRef__carbon_thunk.call = call ptr @_Z10ReturnCRef10ForceThunk.carbon_thunk0(), !dbg !15
  470. // CHECK:STDOUT: %ReturnCRRef__carbon_thunk.call = call ptr @_Z11ReturnCRRef10ForceThunk.carbon_thunk0(), !dbg !16
  471. // CHECK:STDOUT: %ReturnConstCRef__carbon_thunk.call = call ptr @_Z15ReturnConstCRef10ForceThunk.carbon_thunk0(), !dbg !17
  472. // CHECK:STDOUT: %ReturnIntRef__carbon_thunk.call = call ptr @_Z12ReturnIntRef10ForceThunk.carbon_thunk0(), !dbg !18
  473. // CHECK:STDOUT: %ReturnIntRRef__carbon_thunk.call = call ptr @_Z13ReturnIntRRef10ForceThunk.carbon_thunk0(), !dbg !19
  474. // CHECK:STDOUT: %ReturnConstIntRef__carbon_thunk.call = call ptr @_Z17ReturnConstIntRef10ForceThunk.carbon_thunk0(), !dbg !20
  475. // CHECK:STDOUT: ret void, !dbg !21
  476. // CHECK:STDOUT: }
  477. // CHECK:STDOUT:
  478. // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable
  479. // CHECK:STDOUT: define dso_local noundef nonnull align 1 dereferenceable(1) ptr @_Z10ReturnCRef10ForceThunk.carbon_thunk0() #1 {
  480. // CHECK:STDOUT: entry:
  481. // CHECK:STDOUT: %agg.tmp = alloca %class.ForceThunk, align 1
  482. // CHECK:STDOUT: %call = call noundef nonnull align 1 dereferenceable(1) ptr @_Z10ReturnCRef10ForceThunk()
  483. // CHECK:STDOUT: ret ptr %call
  484. // CHECK:STDOUT: }
  485. // CHECK:STDOUT:
  486. // CHECK:STDOUT: declare noundef nonnull align 1 dereferenceable(1) ptr @_Z10ReturnCRef10ForceThunk() #2
  487. // CHECK:STDOUT:
  488. // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable
  489. // CHECK:STDOUT: define dso_local noundef nonnull align 1 dereferenceable(1) ptr @_Z11ReturnCRRef10ForceThunk.carbon_thunk0() #1 {
  490. // CHECK:STDOUT: entry:
  491. // CHECK:STDOUT: %agg.tmp = alloca %class.ForceThunk, align 1
  492. // CHECK:STDOUT: %call = call noundef nonnull align 1 dereferenceable(1) ptr @_Z11ReturnCRRef10ForceThunk()
  493. // CHECK:STDOUT: ret ptr %call
  494. // CHECK:STDOUT: }
  495. // CHECK:STDOUT:
  496. // CHECK:STDOUT: declare noundef nonnull align 1 dereferenceable(1) ptr @_Z11ReturnCRRef10ForceThunk() #2
  497. // CHECK:STDOUT:
  498. // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable
  499. // CHECK:STDOUT: define dso_local noundef nonnull align 1 dereferenceable(1) ptr @_Z15ReturnConstCRef10ForceThunk.carbon_thunk0() #1 {
  500. // CHECK:STDOUT: entry:
  501. // CHECK:STDOUT: %agg.tmp = alloca %class.ForceThunk, align 1
  502. // CHECK:STDOUT: %call = call noundef nonnull align 1 dereferenceable(1) ptr @_Z15ReturnConstCRef10ForceThunk()
  503. // CHECK:STDOUT: ret ptr %call
  504. // CHECK:STDOUT: }
  505. // CHECK:STDOUT:
  506. // CHECK:STDOUT: declare noundef nonnull align 1 dereferenceable(1) ptr @_Z15ReturnConstCRef10ForceThunk() #2
  507. // CHECK:STDOUT:
  508. // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable
  509. // CHECK:STDOUT: define dso_local noundef nonnull align 4 dereferenceable(4) ptr @_Z12ReturnIntRef10ForceThunk.carbon_thunk0() #1 {
  510. // CHECK:STDOUT: entry:
  511. // CHECK:STDOUT: %agg.tmp = alloca %class.ForceThunk, align 1
  512. // CHECK:STDOUT: %call = call noundef nonnull align 4 dereferenceable(4) ptr @_Z12ReturnIntRef10ForceThunk()
  513. // CHECK:STDOUT: ret ptr %call
  514. // CHECK:STDOUT: }
  515. // CHECK:STDOUT:
  516. // CHECK:STDOUT: declare noundef nonnull align 4 dereferenceable(4) ptr @_Z12ReturnIntRef10ForceThunk() #2
  517. // CHECK:STDOUT:
  518. // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable
  519. // CHECK:STDOUT: define dso_local noundef nonnull align 4 dereferenceable(4) ptr @_Z13ReturnIntRRef10ForceThunk.carbon_thunk0() #1 {
  520. // CHECK:STDOUT: entry:
  521. // CHECK:STDOUT: %agg.tmp = alloca %class.ForceThunk, align 1
  522. // CHECK:STDOUT: %call = call noundef nonnull align 4 dereferenceable(4) ptr @_Z13ReturnIntRRef10ForceThunk()
  523. // CHECK:STDOUT: ret ptr %call
  524. // CHECK:STDOUT: }
  525. // CHECK:STDOUT:
  526. // CHECK:STDOUT: declare noundef nonnull align 4 dereferenceable(4) ptr @_Z13ReturnIntRRef10ForceThunk() #2
  527. // CHECK:STDOUT:
  528. // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable
  529. // CHECK:STDOUT: define dso_local noundef nonnull align 4 dereferenceable(4) ptr @_Z17ReturnConstIntRef10ForceThunk.carbon_thunk0() #1 {
  530. // CHECK:STDOUT: entry:
  531. // CHECK:STDOUT: %agg.tmp = alloca %class.ForceThunk, align 1
  532. // CHECK:STDOUT: %call = call noundef nonnull align 4 dereferenceable(4) ptr @_Z17ReturnConstIntRef10ForceThunk()
  533. // CHECK:STDOUT: ret ptr %call
  534. // CHECK:STDOUT: }
  535. // CHECK:STDOUT:
  536. // CHECK:STDOUT: declare noundef nonnull align 4 dereferenceable(4) ptr @_Z17ReturnConstIntRef10ForceThunk() #2
  537. // CHECK:STDOUT:
  538. // CHECK:STDOUT: attributes #0 = { nounwind }
  539. // CHECK:STDOUT: attributes #1 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
  540. // CHECK:STDOUT: attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
  541. // CHECK:STDOUT:
  542. // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4, !5}
  543. // CHECK:STDOUT: !llvm.dbg.cu = !{!6}
  544. // CHECK:STDOUT: !llvm.errno.tbaa = !{!8}
  545. // CHECK:STDOUT:
  546. // CHECK:STDOUT: !0 = !{i32 7, !"Dwarf Version", i32 5}
  547. // CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3}
  548. // CHECK:STDOUT: !2 = !{i32 1, !"wchar_size", i32 4}
  549. // CHECK:STDOUT: !3 = !{i32 8, !"PIC Level", i32 0}
  550. // CHECK:STDOUT: !4 = !{i32 7, !"PIE Level", i32 2}
  551. // CHECK:STDOUT: !5 = !{i32 7, !"uwtable", i32 2}
  552. // CHECK:STDOUT: !6 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !7, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug)
  553. // CHECK:STDOUT: !7 = !DIFile(filename: "return_references_via_thunk.carbon", directory: "")
  554. // CHECK:STDOUT: !8 = !{!9, !9, i64 0}
  555. // CHECK:STDOUT: !9 = !{!"int", !10, i64 0}
  556. // CHECK:STDOUT: !10 = !{!"omnipotent char", !11, i64 0}
  557. // CHECK:STDOUT: !11 = !{!"Simple C++ TBAA"}
  558. // CHECK:STDOUT: !12 = distinct !DISubprogram(name: "GetRefs", linkageName: "_CGetRefs.Main", scope: null, file: !7, line: 17, type: !13, spFlags: DISPFlagDefinition, unit: !6)
  559. // CHECK:STDOUT: !13 = !DISubroutineType(types: !14)
  560. // CHECK:STDOUT: !14 = !{null}
  561. // CHECK:STDOUT: !15 = !DILocation(line: 18, column: 22, scope: !12)
  562. // CHECK:STDOUT: !16 = !DILocation(line: 19, column: 22, scope: !12)
  563. // CHECK:STDOUT: !17 = !DILocation(line: 20, column: 28, scope: !12)
  564. // CHECK:STDOUT: !18 = !DILocation(line: 22, column: 20, scope: !12)
  565. // CHECK:STDOUT: !19 = !DILocation(line: 23, column: 20, scope: !12)
  566. // CHECK:STDOUT: !20 = !DILocation(line: 24, column: 26, scope: !12)
  567. // CHECK:STDOUT: !21 = !DILocation(line: 17, column: 1, scope: !12)