tree: a284e0dcc8b17380db48fd32324a816e3da07a95 [path history] [tgz]
  1. const_prop/
  2. dead-store-elimination/
  3. dest-prop/
  4. inline/
  5. issues/
  6. nll/
  7. 76803_regression.encode.SimplifyBranchSame.diff
  8. 76803_regression.rs
  9. address-of.rs
  10. address_of.address_of_reborrow.SimplifyCfg-initial.after.mir
  11. address_of.borrow_and_cast.SimplifyCfg-initial.after.mir
  12. array-index-is-temporary.rs
  13. array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.mir
  14. asm_unwind_panic_abort.main.AbortUnwindingCalls.after.mir
  15. asm_unwind_panic_abort.rs
  16. basic_assignment.main.SimplifyCfg-initial.after.mir
  17. basic_assignment.rs
  18. bool_compare.opt1.InstCombine.diff
  19. bool_compare.opt2.InstCombine.diff
  20. bool_compare.opt3.InstCombine.diff
  21. bool_compare.opt4.InstCombine.diff
  22. bool_compare.rs
  23. box_expr.main.ElaborateDrops.before.mir
  24. box_expr.rs
  25. byte_slice.main.SimplifyCfg-elaborate-drops.after.mir
  26. byte_slice.rs
  27. combine_array_len.norm2.InstCombine.diff
  28. combine_array_len.rs
  29. combine_clone_of_primitives.rs
  30. combine_clone_of_primitives.{impl#0}-clone.InstCombine.diff
  31. const-promotion-extern-static.rs
  32. const_allocation.main.ConstProp.after.32bit.mir
  33. const_allocation.main.ConstProp.after.64bit.mir
  34. const_allocation.rs
  35. const_allocation2.main.ConstProp.after.32bit.mir
  36. const_allocation2.main.ConstProp.after.64bit.mir
  37. const_allocation2.rs
  38. const_allocation3.main.ConstProp.after.32bit.mir
  39. const_allocation3.main.ConstProp.after.64bit.mir
  40. const_allocation3.rs
  41. const_debuginfo.main.ConstDebugInfo.diff
  42. const_debuginfo.rs
  43. const_goto.issue_77355_opt.ConstGoto.diff
  44. const_goto.rs
  45. const_goto_const_eval_fail.f.ConstGoto.diff
  46. const_goto_const_eval_fail.rs
  47. const_goto_storage.match_nested_if.ConstGoto.diff
  48. const_goto_storage.rs
  49. const_promotion_extern_static.BAR-promoted[0].SimplifyCfg-elaborate-drops.after.mir
  50. const_promotion_extern_static.BAR.PromoteTemps.diff
  51. const_promotion_extern_static.BOP.mir_map.0.mir
  52. const_promotion_extern_static.FOO-promoted[0].SimplifyCfg-elaborate-drops.after.mir
  53. const_promotion_extern_static.FOO.PromoteTemps.diff
  54. const_prop_miscompile.bar.ConstProp.diff
  55. const_prop_miscompile.foo.ConstProp.diff
  56. const_prop_miscompile.rs
  57. coverage_graphviz.bar.InstrumentCoverage.0.dot
  58. coverage_graphviz.main.InstrumentCoverage.0.dot
  59. coverage_graphviz.rs
  60. deaggregator_test.bar.Deaggregator.diff
  61. deaggregator_test.rs
  62. deaggregator_test_enum.bar.Deaggregator.diff
  63. deaggregator_test_enum.rs
  64. deaggregator_test_enum_2.rs
  65. deaggregator_test_enum_2.test1.Deaggregator.diff
  66. deaggregator_test_multiple.rs
  67. deaggregator_test_multiple.test.Deaggregator.diff
  68. deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.diff
  69. deduplicate_blocks.rs
  70. derefer_complex_case.main.Derefer.diff
  71. derefer_complex_case.rs
  72. derefer_inline_test.main.Derefer.diff
  73. derefer_inline_test.rs
  74. derefer_terminator_test.main.Derefer.diff
  75. derefer_terminator_test.rs
  76. derefer_test.main.Derefer.diff
  77. derefer_test.rs
  78. derefer_test_multiple.main.Derefer.diff
  79. derefer_test_multiple.rs
  80. early_otherwise_branch.opt1.EarlyOtherwiseBranch.diff
  81. early_otherwise_branch.opt2.EarlyOtherwiseBranch.diff
  82. early_otherwise_branch.opt3.EarlyOtherwiseBranch.diff
  83. early_otherwise_branch.rs
  84. early_otherwise_branch_3_element_tuple.opt1.EarlyOtherwiseBranch.diff
  85. early_otherwise_branch_3_element_tuple.rs
  86. early_otherwise_branch_68867.rs
  87. early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.diff
  88. early_otherwise_branch_noopt.noopt1.EarlyOtherwiseBranch.diff
  89. early_otherwise_branch_noopt.rs
  90. early_otherwise_branch_soundness.no_deref_ptr.EarlyOtherwiseBranch.diff
  91. early_otherwise_branch_soundness.no_downcast.EarlyOtherwiseBranch.diff
  92. early_otherwise_branch_soundness.rs
  93. enum_cast.bar.mir_map.0.mir
  94. enum_cast.boo.mir_map.0.mir
  95. enum_cast.droppy.mir_map.0.mir
  96. enum_cast.foo.mir_map.0.mir
  97. enum_cast.rs
  98. equal_true.opt.InstCombine.diff
  99. equal_true.rs
  100. exponential-or.rs
  101. exponential_or.match_tuple.SimplifyCfg-initial.after.mir
  102. fn-ptr-shim.rs
  103. fn_ptr_shim.core.ops-function-Fn-call.AddMovesForPackedDrops.before.mir
  104. funky_arms.float_to_exponential_common.ConstProp.diff
  105. funky_arms.rs
  106. generator-drop-cleanup.rs
  107. generator-storage-dead-unwind.rs
  108. generator-tiny.rs
  109. generator_drop_cleanup.main-{closure#0}.generator_drop.0.mir
  110. generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.mir
  111. generator_tiny.main-{closure#0}.generator_resume.0.mir
  112. graphviz.main.mir_map.0.dot
  113. graphviz.rs
  114. if-condition-int.rs
  115. if_condition_int.dont_opt_bool.SimplifyComparisonIntegral.diff
  116. if_condition_int.dont_opt_floats.SimplifyComparisonIntegral.diff
  117. if_condition_int.dont_remove_comparison.SimplifyComparisonIntegral.diff
  118. if_condition_int.opt_char.SimplifyComparisonIntegral.diff
  119. if_condition_int.opt_i8.SimplifyComparisonIntegral.diff
  120. if_condition_int.opt_multiple_ifs.SimplifyComparisonIntegral.diff
  121. if_condition_int.opt_negative.SimplifyComparisonIntegral.diff
  122. if_condition_int.opt_u32.SimplifyComparisonIntegral.diff
  123. instrument_coverage.bar.InstrumentCoverage.diff
  124. instrument_coverage.main.InstrumentCoverage.diff
  125. instrument_coverage.rs
  126. issue-101867.rs
  127. issue-101973.rs
  128. issue-38669.rs
  129. issue-41110.rs
  130. issue-41697.rs
  131. issue-41888.rs
  132. issue-49232.rs
  133. issue-62289.rs
  134. issue-72181-1.rs
  135. issue-72181.rs
  136. issue-73223.rs
  137. issue-78192.rs
  138. issue-91633.rs
  139. issue-99325.rs
  140. issue_101867.main.mir_map.0.mir
  141. issue_101973.inner.ConstProp.diff
  142. issue_38669.main.SimplifyCfg-initial.after.mir
  143. issue_41110.main.ElaborateDrops.after.mir
  144. issue_41110.test.ElaborateDrops.after.mir
  145. issue_41697.{impl#0}-{constant#0}.SimplifyCfg-promote-consts.after.mir
  146. issue_41888.main.ElaborateDrops.after.mir
  147. issue_49232.main.mir_map.0.mir
  148. issue_62289.test.ElaborateDrops.before.mir
  149. issue_72181.bar.mir_map.0.mir
  150. issue_72181.foo.mir_map.0.mir
  151. issue_72181.main.mir_map.0.mir
  152. issue_72181_1.f.mir_map.0.mir
  153. issue_72181_1.main.mir_map.0.mir
  154. issue_73223.main.SimplifyArmIdentity.diff
  155. issue_76432.rs
  156. issue_76432.test.SimplifyComparisonIntegral.diff
  157. issue_78192.f.InstCombine.diff
  158. issue_91633.bar.mir_map.0.mir
  159. issue_91633.foo.mir_map.0.mir
  160. issue_91633.fun.mir_map.0.mir
  161. issue_91633.hey.mir_map.0.mir
  162. issue_99325.main.mir_map.0.mir
  163. loop_test.main.SimplifyCfg-promote-consts.after.mir
  164. loop_test.rs
  165. lower_array_len.array_bound.NormalizeArrayLen.diff
  166. lower_array_len.array_bound_mut.NormalizeArrayLen.diff
  167. lower_array_len.array_len.NormalizeArrayLen.diff
  168. lower_array_len.array_len_by_value.NormalizeArrayLen.diff
  169. lower_array_len.rs
  170. lower_array_len_e2e.array_bound.PreCodegen.after.mir
  171. lower_array_len_e2e.array_bound_mut.PreCodegen.after.mir
  172. lower_array_len_e2e.array_len.PreCodegen.after.mir
  173. lower_array_len_e2e.array_len_by_value.PreCodegen.after.mir
  174. lower_array_len_e2e.rs
  175. lower_intrinsics.align_of.LowerIntrinsics.diff
  176. lower_intrinsics.assume.LowerIntrinsics.diff
  177. lower_intrinsics.discriminant.LowerIntrinsics.diff
  178. lower_intrinsics.f_copy_nonoverlapping.LowerIntrinsics.diff
  179. lower_intrinsics.forget.LowerIntrinsics.diff
  180. lower_intrinsics.non_const.LowerIntrinsics.diff
  181. lower_intrinsics.rs
  182. lower_intrinsics.size_of.LowerIntrinsics.diff
  183. lower_intrinsics.unreachable.LowerIntrinsics.diff
  184. lower_intrinsics.wrapping.LowerIntrinsics.diff
  185. lower_intrinsics_e2e.f_u64.PreCodegen.after.mir
  186. lower_intrinsics_e2e.f_unit.PreCodegen.after.mir
  187. lower_intrinsics_e2e.rs
  188. lower_slice_len.bound.LowerSliceLenCalls.diff
  189. lower_slice_len.rs
  190. match-arm-scopes.rs
  191. match_arm_scopes.complicated_match.SimplifyCfg-initial.after-ElaborateDrops.after.diff
  192. match_false_edges.full_tested_match.PromoteTemps.after.mir
  193. match_false_edges.full_tested_match2.PromoteTemps.before.mir
  194. match_false_edges.main.PromoteTemps.before.mir
  195. match_false_edges.rs
  196. match_test.main.SimplifyCfg-initial.after.mir
  197. match_test.rs
  198. matches_reduce_branches.bar.MatchBranchSimplification.diff
  199. matches_reduce_branches.foo.MatchBranchSimplification.diff
  200. matches_reduce_branches.match_nested_if.MatchBranchSimplification.diff
  201. matches_reduce_branches.rs
  202. matches_u8.exhaustive_match.MatchBranchSimplification.diff
  203. matches_u8.exhaustive_match_i8.MatchBranchSimplification.diff
  204. matches_u8.rs
  205. multiple_return_terminators.rs
  206. multiple_return_terminators.test.MultipleReturnTerminators.diff
  207. no-drop-for-inactive-variant.rs
  208. no-spurious-drop-after-call.rs
  209. no_drop_for_inactive_variant.unwrap.SimplifyCfg-elaborate-drops.after.mir
  210. no_spurious_drop_after_call.main.ElaborateDrops.before.mir
  211. not_equal_false.opt.InstCombine.diff
  212. not_equal_false.rs
  213. nrvo-simple.rs
  214. nrvo_simple.nrvo.RenameReturnPlace.diff
  215. packed-struct-drop-aligned.rs
  216. packed_struct_drop_aligned.main.SimplifyCfg-elaborate-drops.after.mir
  217. README.md
  218. receiver-ptr-mutability.rs
  219. receiver_ptr_mutability.main.mir_map.0.mir
  220. remove-never-const.rs
  221. remove_fake_borrows.match_guard.CleanupNonCodegenStatements.diff
  222. remove_fake_borrows.rs
  223. remove_never_const.no_codegen.PreCodegen.after.mir
  224. remove_storage_markers.main.RemoveStorageMarkers.diff
  225. remove_storage_markers.rs
  226. remove_unneeded_drops.cannot_opt_generic.RemoveUnneededDrops.diff
  227. remove_unneeded_drops.dont_opt.RemoveUnneededDrops.diff
  228. remove_unneeded_drops.opt.RemoveUnneededDrops.diff
  229. remove_unneeded_drops.opt_generic_copy.RemoveUnneededDrops.diff
  230. remove_unneeded_drops.rs
  231. remove_zsts_dont_touch_unions.get_union.RemoveZsts.after.mir
  232. remove_zsts_dont_touch_unions.rs
  233. retag.array_casts.SimplifyCfg-elaborate-drops.after.mir
  234. retag.core.ptr-drop_in_place.Test.SimplifyCfg-make_shim.after.mir
  235. retag.main-{closure#0}.SimplifyCfg-elaborate-drops.after.mir
  236. retag.main.SimplifyCfg-elaborate-drops.after.mir
  237. retag.rs
  238. retag.{impl#0}-foo.SimplifyCfg-elaborate-drops.after.mir
  239. retag.{impl#0}-foo_shr.SimplifyCfg-elaborate-drops.after.mir
  240. return_an_array.rs
  241. rustc.try_identity.DestinationPropagation.diff
  242. separate_const_switch.identity.SeparateConstSwitch.diff
  243. separate_const_switch.rs
  244. separate_const_switch.too_complex.SeparateConstSwitch.diff
  245. simple-match.rs
  246. simple_match.match_bool.mir_map.0.mir
  247. simplify-arm-identity.rs
  248. simplify-arm.rs
  249. simplify-locals-fixedpoint.rs
  250. simplify-locals-removes-unused-consts.rs
  251. simplify-locals-removes-unused-discriminant-reads.rs
  252. simplify-locals.rs
  253. simplify_arm.id_try.SimplifyArmIdentity.diff
  254. simplify_arm.id_try.SimplifyBranchSame.diff
  255. simplify_cfg.main.SimplifyCfg-early-opt.diff
  256. simplify_cfg.main.SimplifyCfg-initial.diff
  257. simplify_cfg.rs
  258. simplify_if.main.SimplifyConstCondition-after-const-prop.diff
  259. simplify_if.rs
  260. simplify_locals.c.SimplifyLocals.diff
  261. simplify_locals.d1.SimplifyLocals.diff
  262. simplify_locals.d2.SimplifyLocals.diff
  263. simplify_locals.expose_addr.SimplifyLocals.diff
  264. simplify_locals.r.SimplifyLocals.diff
  265. simplify_locals.t1.SimplifyLocals.diff
  266. simplify_locals.t2.SimplifyLocals.diff
  267. simplify_locals.t3.SimplifyLocals.diff
  268. simplify_locals.t4.SimplifyLocals.diff
  269. simplify_locals_fixedpoint.foo.SimplifyLocals.diff
  270. simplify_locals_removes_unused_consts.main.SimplifyLocals.diff
  271. simplify_locals_removes_unused_discriminant_reads.map.SimplifyLocals.diff
  272. simplify_match.main.ConstProp.diff
  273. simplify_match.rs
  274. simplify_try.try_identity.DestinationPropagation.diff
  275. simplify_try.try_identity.SimplifyArmIdentity.diff
  276. simplify_try.try_identity.SimplifyBranchSame.after.mir
  277. simplify_try.try_identity.SimplifyLocals.after.mir
  278. simplify_try_if_let.rs
  279. simplify_try_if_let.{impl#0}-append.SimplifyArmIdentity.diff
  280. slice-drop-shim.rs
  281. slice_drop_shim.core.ptr-drop_in_place.[String].AddMovesForPackedDrops.before.mir
  282. spanview-block.rs
  283. spanview-statement.rs
  284. spanview-terminator.rs
  285. spanview_block.main.mir_map.0.html
  286. spanview_statement.main.mir_map.0.html
  287. spanview_terminator.main.mir_map.0.html
  288. storage_live_dead_in_statics.rs
  289. storage_live_dead_in_statics.XXX.mir_map.0.mir
  290. storage_ranges.main.nll.0.mir
  291. storage_ranges.rs
  292. tls-access.rs
  293. tls_access.main.PreCodegen.after.mir
  294. try_identity_e2e.new.PreCodegen.after.mir
  295. try_identity_e2e.old.PreCodegen.after.mir
  296. try_identity_e2e.rs
  297. uniform_array_move_out.move_out_by_subslice.mir_map.0.mir
  298. uniform_array_move_out.move_out_from_end.mir_map.0.mir
  299. uniform_array_move_out.rs
  300. uninhabited-enum.rs
  301. uninhabited_enum.process_never.SimplifyLocals.after.mir
  302. uninhabited_enum.process_void.SimplifyLocals.after.mir
  303. uninhabited_enum_branching.main.SimplifyCfg-after-uninhabited-enum-branching.after.mir
  304. uninhabited_enum_branching.main.UninhabitedEnumBranching.diff
  305. uninhabited_enum_branching.rs
  306. uninhabited_enum_branching2.main.SimplifyCfg-after-uninhabited-enum-branching.after.mir
  307. uninhabited_enum_branching2.main.UninhabitedEnumBranching.diff
  308. uninhabited_enum_branching2.rs
  309. uninhabited_fallthrough_elimination.eliminate_fallthrough.UninhabitedEnumBranching.diff
  310. uninhabited_fallthrough_elimination.keep_fallthrough.UninhabitedEnumBranching.diff
  311. uninhabited_fallthrough_elimination.rs
  312. unreachable.main.UnreachablePropagation.diff
  313. unreachable.rs
  314. unreachable_diverging.main.UnreachablePropagation.diff
  315. unreachable_diverging.rs
  316. unusual-item-types.rs
  317. unusual_item_types.core.ptr-drop_in_place.Vec_i32_.AddMovesForPackedDrops.before.mir
  318. unusual_item_types.E-V-{constant#0}.mir_map.0.mir
  319. unusual_item_types.Test-X-{constructor#0}.mir_map.0.mir
  320. unusual_item_types.{impl#0}-ASSOCIATED_CONSTANT.mir_map.0.mir
  321. while-storage.rs
  322. while_let_loops.change_loop_body.ConstProp.diff
  323. while_let_loops.change_loop_body.PreCodegen.after.mir
  324. while_let_loops.rs
  325. while_storage.while_loop.PreCodegen.after.mir
src/test/mir-opt/README.md

This folder contains tests for MIR optimizations.

The mir-opt test format emits MIR to extra files that you can automatically update by specifying --bless on the command line (just like ui tests updating .stderr files).

--blessable test format

By default 32 bit and 64 bit targets use the same dump files, which can be problematic in the presence of pointers in constants or other bit width dependent things. In that case you can add

// EMIT_MIR_FOR_EACH_BIT_WIDTH

to your test, causing separate files to be generated for 32bit and 64bit systems.

Unit testing

If you are only testing the behavior of a particular mir-opt pass on some specific input (as is usually the case), you should add

// unit-test: PassName

to the top of the file. This makes sure that other passes don‘t run which means you’ll get the input you expected and your test won't break when other code changes.

Emit a diff of the mir for a specific optimization

This is what you want most often when you want to see how an optimization changes the MIR.

// EMIT_MIR $file_name_of_some_mir_dump.diff

Emit mir after a specific optimization

Use this if you are just interested in the final state after an optimization.

// EMIT_MIR $file_name_of_some_mir_dump.after.mir

Emit mir before a specific optimization

This exists mainly for completeness and is rarely useful.

// EMIT_MIR $file_name_of_some_mir_dump.before.mir