From c29bbde2e3de75bbf99261214958d3f7498e362d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Baylac=20Jacqu=C3=A9?= Date: Sun, 13 Nov 2022 07:18:43 +0100 Subject: [PATCH] init --- .gitignore | 0 cheval.ll | 177 +++++++++++++++++++++++++ cheval.mir | 330 +++++++++++++++++++++++++++++++++++++++++++++++ cheval.mir.unopt | 276 +++++++++++++++++++++++++++++++++++++++ cheval.rs | 20 +++ cheval.s | 181 ++++++++++++++++++++++++++ 6 files changed, 984 insertions(+) create mode 100644 .gitignore create mode 100644 cheval.ll create mode 100644 cheval.mir create mode 100644 cheval.mir.unopt create mode 100644 cheval.rs create mode 100644 cheval.s diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/cheval.ll b/cheval.ll new file mode 100644 index 0000000..6e6e64b --- /dev/null +++ b/cheval.ll @@ -0,0 +1,177 @@ +; ModuleID = 'cheval.434b2442-cgu.0' +source_filename = "cheval.434b2442-cgu.0" +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +%"core::fmt::Arguments" = type { { [0 x { [0 x i8]*, i64 }]*, i64 }, { i64*, i64 }, { [0 x { i8*, i64* }]*, i64 } } +%"unwind::libunwind::_Unwind_Exception" = type { i64, void (i32, %"unwind::libunwind::_Unwind_Exception"*)*, [6 x i64] } +%"unwind::libunwind::_Unwind_Context" = type { [0 x i8] } +%"core::fmt::Formatter" = type { { i64, i64 }, { i64, i64 }, { {}*, [3 x i64]* }, i32, i32, i8, [7 x i8] } + +@vtable.0 = private unnamed_addr constant <{ i8*, [16 x i8], i8*, i8*, i8* }> <{ i8* bitcast (void (i64**)* @"_ZN4core3ptr85drop_in_place$LT$std..rt..lang_start$LT$$LP$$RP$$GT$..$u7b$$u7b$closure$u7d$$u7d$$GT$17h329c60c5ef7796efE" to i8*), [16 x i8] c"\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00", i8* bitcast (i32 (i64**)* @"_ZN4core3ops8function6FnOnce40call_once$u7b$$u7b$vtable.shim$u7d$$u7d$17h59ddb332eff5b283E" to i8*), i8* bitcast (i32 (i64**)* @"_ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17h4d50961104610955E" to i8*), i8* bitcast (i32 (i64**)* @"_ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17h4d50961104610955E" to i8*) }>, align 8 +@alloc3 = private unnamed_addr constant <{}> zeroinitializer, align 8 +@alloc5 = private unnamed_addr constant <{ [1 x i8] }> <{ [1 x i8] c"\0A" }>, align 1 +@alloc4 = private unnamed_addr constant <{ i8*, [8 x i8], i8*, [8 x i8] }> <{ i8* bitcast (<{}>* @alloc3 to i8*), [8 x i8] zeroinitializer, i8* getelementptr inbounds (<{ [1 x i8] }>, <{ [1 x i8] }>* @alloc5, i32 0, i32 0, i32 0), [8 x i8] c"\01\00\00\00\00\00\00\00" }>, align 8 + +; std::sys_common::backtrace::__rust_begin_short_backtrace +; Function Attrs: noinline nonlazybind uwtable +define internal fastcc void @_ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17h41f8b7da52e89b98E(void ()* nocapture noundef nonnull readonly %f) unnamed_addr #0 personality i32 (i32, i32, i64, %"unwind::libunwind::_Unwind_Exception"*, %"unwind::libunwind::_Unwind_Context"*)* @rust_eh_personality { +start: + tail call void %f() + tail call void asm sideeffect "", "r,~{memory}"({}* undef) #7, !srcloc !3 + ret void +} + +; std::rt::lang_start +; Function Attrs: nonlazybind uwtable +define hidden i64 @_ZN3std2rt10lang_start17he131ba9074e25360E(void ()* noundef nonnull %main, i64 %argc, i8** %argv) unnamed_addr #1 { +start: + %_8 = alloca i64*, align 8 + %0 = bitcast i64** %_8 to i8* + call void @llvm.lifetime.start.p0i8(i64 8, i8* nonnull %0) + %1 = bitcast i64** %_8 to void ()** + store void ()* %main, void ()** %1, align 8 + %_5.0 = bitcast i64** %_8 to {}* +; call std::rt::lang_start_internal + %2 = call i64 @_ZN3std2rt19lang_start_internal17h09bcc9fffd987f14E({}* noundef nonnull align 1 %_5.0, [3 x i64]* noalias noundef readonly align 8 dereferenceable(24) bitcast (<{ i8*, [16 x i8], i8*, i8*, i8* }>* @vtable.0 to [3 x i64]*), i64 %argc, i8** %argv) + call void @llvm.lifetime.end.p0i8(i64 8, i8* nonnull %0) + ret i64 %2 +} + +; std::rt::lang_start::{{closure}} +; Function Attrs: inlinehint nonlazybind uwtable +define internal i32 @"_ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17h4d50961104610955E"(i64** noalias nocapture noundef readonly align 8 dereferenceable(8) %_1) unnamed_addr #2 { +start: + %0 = bitcast i64** %_1 to void ()** + %_4 = load void ()*, void ()** %0, align 8, !nonnull !4, !noundef !4 +; call std::sys_common::backtrace::__rust_begin_short_backtrace + tail call fastcc void @_ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17h41f8b7da52e89b98E(void ()* noundef nonnull %_4) + ret i32 0 +} + +; core::ops::function::FnOnce::call_once{{vtable.shim}} +; Function Attrs: inlinehint nonlazybind uwtable +define internal i32 @"_ZN4core3ops8function6FnOnce40call_once$u7b$$u7b$vtable.shim$u7d$$u7d$17h59ddb332eff5b283E"(i64** nocapture readonly %_1) unnamed_addr #2 personality i32 (i32, i32, i64, %"unwind::libunwind::_Unwind_Exception"*, %"unwind::libunwind::_Unwind_Context"*)* @rust_eh_personality { +start: + %0 = bitcast i64** %_1 to void ()** + %1 = load void ()*, void ()** %0, align 8, !nonnull !4 +; call std::sys_common::backtrace::__rust_begin_short_backtrace + tail call fastcc void @_ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17h41f8b7da52e89b98E(void ()* noundef nonnull %1), !noalias !5 + ret i32 0 +} + +; core::ptr::drop_in_place::{{closure}}> +; Function Attrs: inlinehint mustprogress nofree norecurse nosync nounwind nonlazybind readnone uwtable willreturn +define internal void @"_ZN4core3ptr85drop_in_place$LT$std..rt..lang_start$LT$$LP$$RP$$GT$..$u7b$$u7b$closure$u7d$$u7d$$GT$17h329c60c5ef7796efE"(i64** nocapture readnone %_1) unnamed_addr #3 { +start: + ret void +} + +; cheval::main +; Function Attrs: nonlazybind uwtable +define internal void @_ZN6cheval4main17hb27520a1fe33142bE() unnamed_addr #1 { +start: + %_13 = alloca i64, align 8 + %_9 = alloca [1 x { i8*, i64* }], align 8 + %_2 = alloca %"core::fmt::Arguments", align 8 + %0 = bitcast %"core::fmt::Arguments"* %_2 to i8* + call void @llvm.lifetime.start.p0i8(i64 48, i8* nonnull %0) + %1 = bitcast [1 x { i8*, i64* }]* %_9 to i8* + call void @llvm.lifetime.start.p0i8(i64 16, i8* nonnull %1) + %2 = bitcast i64* %_13 to i8* + call void @llvm.lifetime.start.p0i8(i64 8, i8* nonnull %2) +; call cheval::main_test + %3 = tail call fastcc i64 @_ZN6cheval9main_test17h920cf553da9b6fa6E() + store i64 %3, i64* %_13, align 8 + %4 = bitcast [1 x { i8*, i64* }]* %_9 to i64** + store i64* %_13, i64** %4, align 8 + %5 = getelementptr inbounds [1 x { i8*, i64* }], [1 x { i8*, i64* }]* %_9, i64 0, i64 0, i32 1 + store i64* bitcast (i1 (i64*, %"core::fmt::Formatter"*)* @"_ZN4core3fmt3num3imp52_$LT$impl$u20$core..fmt..Display$u20$for$u20$i64$GT$3fmt17h7f25baa19e0cd7d8E" to i64*), i64** %5, align 8 + %6 = getelementptr inbounds %"core::fmt::Arguments", %"core::fmt::Arguments"* %_2, i64 0, i32 0, i32 0 + store [0 x { [0 x i8]*, i64 }]* bitcast (<{ i8*, [8 x i8], i8*, [8 x i8] }>* @alloc4 to [0 x { [0 x i8]*, i64 }]*), [0 x { [0 x i8]*, i64 }]** %6, align 8, !alias.scope !8, !noalias !11 + %7 = getelementptr inbounds %"core::fmt::Arguments", %"core::fmt::Arguments"* %_2, i64 0, i32 0, i32 1 + store i64 2, i64* %7, align 8, !alias.scope !8, !noalias !11 + %8 = getelementptr inbounds %"core::fmt::Arguments", %"core::fmt::Arguments"* %_2, i64 0, i32 1, i32 0 + store i64* null, i64** %8, align 8, !alias.scope !8, !noalias !11 + %9 = getelementptr inbounds %"core::fmt::Arguments", %"core::fmt::Arguments"* %_2, i64 0, i32 2, i32 0 + %10 = bitcast [0 x { i8*, i64* }]** %9 to [1 x { i8*, i64* }]** + store [1 x { i8*, i64* }]* %_9, [1 x { i8*, i64* }]** %10, align 8, !alias.scope !8, !noalias !11 + %11 = getelementptr inbounds %"core::fmt::Arguments", %"core::fmt::Arguments"* %_2, i64 0, i32 2, i32 1 + store i64 1, i64* %11, align 8, !alias.scope !8, !noalias !11 +; call std::io::stdio::_print + call void @_ZN3std2io5stdio6_print17hdb1c1fab578c3488E(%"core::fmt::Arguments"* noalias nocapture noundef nonnull dereferenceable(48) %_2) + call void @llvm.lifetime.end.p0i8(i64 48, i8* nonnull %0) + call void @llvm.lifetime.end.p0i8(i64 8, i8* nonnull %2) + call void @llvm.lifetime.end.p0i8(i64 16, i8* nonnull %1) + ret void +} + +; cheval::main_test +; Function Attrs: mustprogress nofree noinline nosync nounwind nonlazybind uwtable willreturn +define internal fastcc i64 @_ZN6cheval9main_test17h920cf553da9b6fa6E() unnamed_addr #4 personality i32 (i32, i32, i64, %"unwind::libunwind::_Unwind_Exception"*, %"unwind::libunwind::_Unwind_Context"*)* @rust_eh_personality { +start: + ret i64 5 +} + +; Function Attrs: nonlazybind uwtable +declare noundef i32 @rust_eh_personality(i32, i32 noundef, i64, %"unwind::libunwind::_Unwind_Exception"*, %"unwind::libunwind::_Unwind_Context"*) unnamed_addr #1 + +; Function Attrs: argmemonly mustprogress nofree nosync nounwind willreturn +declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture) #5 + +; Function Attrs: argmemonly mustprogress nofree nosync nounwind willreturn +declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture) #5 + +; std::rt::lang_start_internal +; Function Attrs: nonlazybind uwtable +declare i64 @_ZN3std2rt19lang_start_internal17h09bcc9fffd987f14E({}* noundef nonnull align 1, [3 x i64]* noalias noundef readonly align 8 dereferenceable(24), i64, i8**) unnamed_addr #1 + +; core::fmt::num::imp::::fmt +; Function Attrs: nonlazybind uwtable +declare noundef zeroext i1 @"_ZN4core3fmt3num3imp52_$LT$impl$u20$core..fmt..Display$u20$for$u20$i64$GT$3fmt17h7f25baa19e0cd7d8E"(i64* noalias noundef readonly align 8 dereferenceable(8), %"core::fmt::Formatter"* noalias noundef align 8 dereferenceable(64)) unnamed_addr #1 + +; std::io::stdio::_print +; Function Attrs: nonlazybind uwtable +declare void @_ZN3std2io5stdio6_print17hdb1c1fab578c3488E(%"core::fmt::Arguments"* noalias nocapture noundef dereferenceable(48)) unnamed_addr #1 + +; Function Attrs: nonlazybind +define i32 @main(i32 %0, i8** %1) unnamed_addr #6 { +top: + %_8.i = alloca i64*, align 8 + %2 = sext i32 %0 to i64 + %3 = bitcast i64** %_8.i to i8* + call void @llvm.lifetime.start.p0i8(i64 8, i8* nonnull %3) + %4 = bitcast i64** %_8.i to void ()** + store void ()* @_ZN6cheval4main17hb27520a1fe33142bE, void ()** %4, align 8 + %_5.0.i = bitcast i64** %_8.i to {}* +; call std::rt::lang_start_internal + %5 = call i64 @_ZN3std2rt19lang_start_internal17h09bcc9fffd987f14E({}* noundef nonnull align 1 %_5.0.i, [3 x i64]* noalias noundef readonly align 8 dereferenceable(24) bitcast (<{ i8*, [16 x i8], i8*, i8*, i8* }>* @vtable.0 to [3 x i64]*), i64 %2, i8** %1) + call void @llvm.lifetime.end.p0i8(i64 8, i8* nonnull %3) + %6 = trunc i64 %5 to i32 + ret i32 %6 +} + +attributes #0 = { noinline nonlazybind uwtable "probe-stack"="__rust_probestack" "target-cpu"="x86-64" } +attributes #1 = { nonlazybind uwtable "probe-stack"="__rust_probestack" "target-cpu"="x86-64" } +attributes #2 = { inlinehint nonlazybind uwtable "probe-stack"="__rust_probestack" "target-cpu"="x86-64" } +attributes #3 = { inlinehint mustprogress nofree norecurse nosync nounwind nonlazybind readnone uwtable willreturn "probe-stack"="__rust_probestack" "target-cpu"="x86-64" } +attributes #4 = { mustprogress nofree noinline nosync nounwind nonlazybind uwtable willreturn "probe-stack"="__rust_probestack" "target-cpu"="x86-64" } +attributes #5 = { argmemonly mustprogress nofree nosync nounwind willreturn } +attributes #6 = { nonlazybind "probe-stack"="__rust_probestack" "target-cpu"="x86-64" } +attributes #7 = { nounwind } + +!llvm.module.flags = !{!0, !1, !2} + +!0 = !{i32 7, !"PIC Level", i32 2} +!1 = !{i32 7, !"PIE Level", i32 2} +!2 = !{i32 2, !"RtLibUseGOT", i32 1} +!3 = !{i32 3341193} +!4 = !{} +!5 = !{!6} +!6 = distinct !{!6, !7, !"_ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17h4d50961104610955E: %_1"} +!7 = distinct !{!7, !"_ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17h4d50961104610955E"} +!8 = !{!9} +!9 = distinct !{!9, !10, !"_ZN4core3fmt9Arguments6new_v117hfd5b3bd3ae423f07E: argument 0"} +!10 = distinct !{!10, !"_ZN4core3fmt9Arguments6new_v117hfd5b3bd3ae423f07E"} +!11 = !{!12} +!12 = distinct !{!12, !10, !"_ZN4core3fmt9Arguments6new_v117hfd5b3bd3ae423f07E: %args.0"} diff --git a/cheval.mir b/cheval.mir new file mode 100644 index 0000000..ba0d0f7 --- /dev/null +++ b/cheval.mir @@ -0,0 +1,330 @@ +// WARNING: This output format is intended for human consumers only +// and is subject to change without notice. Knock yourself out. +fn main() -> () { + let mut _0: (); // return place in scope 0 at cheval.rs:1:16: 1:16 + let _1: (); // in scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:9: 136:62 + let mut _2: std::fmt::Arguments<'_>; // in scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:28: 136:61 + let mut _3: &[&str]; // in scope 0 at cheval.rs:2:14: 2:18 + let mut _4: &[&str; 2]; // in scope 0 at cheval.rs:2:14: 2:18 + let _5: &[&str; 2]; // in scope 0 at cheval.rs:2:14: 2:18 + let mut _6: &[std::fmt::ArgumentV1<'_>]; // in scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:28: 136:61 + let mut _7: &[std::fmt::ArgumentV1<'_>; 1]; // in scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:28: 136:61 + let _8: &[std::fmt::ArgumentV1<'_>; 1]; // in scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:28: 136:61 + let _9: [std::fmt::ArgumentV1<'_>; 1]; // in scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:28: 136:61 + let mut _10: std::fmt::ArgumentV1<'_>; // in scope 0 at cheval.rs:2:20: 2:31 + let mut _11: &i64; // in scope 0 at cheval.rs:2:20: 2:31 + let _12: &i64; // in scope 0 at cheval.rs:2:20: 2:31 + let _13: i64; // in scope 0 at cheval.rs:2:20: 2:31 + let mut _14: &[&str; 2]; // in scope 0 at cheval.rs:2:14: 2:18 + scope 1 (inlined ArgumentV1::<'_>::new_display::) { // at cheval.rs:2:20: 2:31 + debug x => _11; // in scope 1 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/fmt/mod.rs:322:30: 322:31 + let mut _15: &i64; // in scope 1 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/fmt/mod.rs:323:23: 323:24 + let mut _16: for<'a, 'b, 'c> fn(&'a i64, &'b mut std::fmt::Formatter<'c>) -> std::result::Result<(), std::fmt::Error>; // in scope 1 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/fmt/mod.rs:323:26: 323:33 + scope 2 (inlined ArgumentV1::<'_>::new::) { // at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/fmt/mod.rs:323:13: 323:34 + debug x => _15; // in scope 2 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/fmt/mod.rs:333:23: 333:24 + debug f => _16; // in scope 2 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/fmt/mod.rs:333:33: 333:34 + let mut _17: for<'a, 'b, 'c> fn(&'a core::fmt::Opaque, &'b mut std::fmt::Formatter<'c>) -> std::result::Result<(), std::fmt::Error>; // in scope 2 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/fmt/mod.rs:342:42: 342:59 + let mut _18: for<'a, 'b, 'c> fn(&'a i64, &'b mut std::fmt::Formatter<'c>) -> std::result::Result<(), std::fmt::Error>; // in scope 2 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/fmt/mod.rs:342:57: 342:58 + let mut _19: &core::fmt::Opaque; // in scope 2 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/fmt/mod.rs:342:68: 342:85 + let mut _20: &i64; // in scope 2 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/fmt/mod.rs:342:83: 342:84 + scope 3 { + } + } + } + + bb0: { + StorageLive(_1); // scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:9: 136:62 + StorageLive(_2); // scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:28: 136:61 + StorageLive(_3); // scope 0 at cheval.rs:2:14: 2:18 + StorageLive(_4); // scope 0 at cheval.rs:2:14: 2:18 + StorageLive(_5); // scope 0 at cheval.rs:2:14: 2:18 + _14 = const _; // scope 0 at cheval.rs:2:14: 2:18 + // mir::Constant + // + span: cheval.rs:2:14: 2:18 + // + literal: Const { ty: &[&str; 2], val: Unevaluated(main, [], Some(promoted[0])) } + _5 = _14; // scope 0 at cheval.rs:2:14: 2:18 + _4 = _5; // scope 0 at cheval.rs:2:14: 2:18 + _3 = move _4 as &[&str] (Pointer(Unsize)); // scope 0 at cheval.rs:2:14: 2:18 + StorageDead(_4); // scope 0 at cheval.rs:2:17: 2:18 + StorageLive(_6); // scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:28: 136:61 + StorageLive(_7); // scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:28: 136:61 + StorageLive(_8); // scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:28: 136:61 + StorageLive(_9); // scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:28: 136:61 + StorageLive(_10); // scope 0 at cheval.rs:2:20: 2:31 + StorageLive(_11); // scope 0 at cheval.rs:2:20: 2:31 + StorageLive(_12); // scope 0 at cheval.rs:2:20: 2:31 + StorageLive(_13); // scope 0 at cheval.rs:2:20: 2:31 + _13 = main_test() -> bb1; // scope 0 at cheval.rs:2:20: 2:31 + // mir::Constant + // + span: cheval.rs:2:20: 2:29 + // + literal: Const { ty: fn() -> i64 {main_test}, val: Value() } + } + + bb1: { + _12 = &_13; // scope 0 at cheval.rs:2:20: 2:31 + _11 = _12; // scope 0 at cheval.rs:2:20: 2:31 + StorageLive(_15); // scope 1 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/fmt/mod.rs:323:23: 323:24 + _15 = _11; // scope 1 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/fmt/mod.rs:323:23: 323:24 + StorageLive(_16); // scope 1 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/fmt/mod.rs:323:26: 323:33 + _16 = ::fmt as for<'a, 'b, 'c> fn(&'a i64, &'b mut std::fmt::Formatter<'c>) -> std::result::Result<(), std::fmt::Error> (Pointer(ReifyFnPointer)); // scope 1 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/fmt/mod.rs:323:26: 323:33 + // mir::Constant + // + span: /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/fmt/mod.rs:323:26: 323:33 + // + literal: Const { ty: for<'a, 'b, 'c> fn(&'a i64, &'b mut Formatter<'c>) -> Result<(), std::fmt::Error> {::fmt}, val: Value() } + StorageLive(_17); // scope 3 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/fmt/mod.rs:342:42: 342:59 + StorageLive(_18); // scope 3 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/fmt/mod.rs:342:57: 342:58 + _18 = _16; // scope 3 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/fmt/mod.rs:342:57: 342:58 + _17 = transmute:: fn(&'a i64, &'b mut Formatter<'c>) -> Result<(), std::fmt::Error>, for<'a, 'b, 'c> fn(&'a core::fmt::Opaque, &'b mut Formatter<'c>) -> Result<(), std::fmt::Error>>(move _18) -> bb4; // scope 3 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/fmt/mod.rs:342:42: 342:59 + // mir::Constant + // + span: /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/fmt/mod.rs:342:42: 342:56 + // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(for<'a, 'b, 'c> fn(&'a i64, &'b mut Formatter<'c>) -> Result<(), std::fmt::Error>) -> for<'a, 'b, 'c> fn(&'a core::fmt::Opaque, &'b mut Formatter<'c>) -> Result<(), std::fmt::Error> {transmute:: fn(&'a i64, &'b mut Formatter<'c>) -> Result<(), std::fmt::Error>, for<'a, 'b, 'c> fn(&'a core::fmt::Opaque, &'b mut Formatter<'c>) -> Result<(), std::fmt::Error>>}, val: Value() } + } + + bb2: { + StorageDead(_6); // scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:60: 136:61 + StorageDead(_3); // scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:60: 136:61 + _1 = _print(move _2) -> bb3; // scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:9: 136:62 + // mir::Constant + // + span: /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:9: 136:27 + // + literal: Const { ty: for<'a> fn(Arguments<'a>) {_print}, val: Value() } + } + + bb3: { + StorageDead(_2); // scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:61: 136:62 + StorageDead(_13); // scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:62: 136:63 + StorageDead(_12); // scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:62: 136:63 + StorageDead(_9); // scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:62: 136:63 + StorageDead(_8); // scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:62: 136:63 + StorageDead(_5); // scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:62: 136:63 + StorageDead(_1); // scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:62: 136:63 + return; // scope 0 at cheval.rs:3:2: 3:2 + } + + bb4: { + StorageDead(_18); // scope 3 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/fmt/mod.rs:342:58: 342:59 + StorageLive(_19); // scope 3 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/fmt/mod.rs:342:68: 342:85 + StorageLive(_20); // scope 3 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/fmt/mod.rs:342:83: 342:84 + _20 = _15; // scope 3 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/fmt/mod.rs:342:83: 342:84 + _19 = transmute::<&i64, &core::fmt::Opaque>(move _20) -> bb5; // scope 3 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/fmt/mod.rs:342:68: 342:85 + // mir::Constant + // + span: /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/fmt/mod.rs:342:68: 342:82 + // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(&i64) -> &core::fmt::Opaque {transmute::<&i64, &core::fmt::Opaque>}, val: Value() } + } + + bb5: { + StorageDead(_20); // scope 3 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/fmt/mod.rs:342:84: 342:85 + Deinit(_10); // scope 3 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/fmt/mod.rs:342:18: 342:87 + (_10.0: &core::fmt::Opaque) = move _19; // scope 3 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/fmt/mod.rs:342:18: 342:87 + (_10.1: for<'a, 'b, 'c> fn(&'a core::fmt::Opaque, &'b mut std::fmt::Formatter<'c>) -> std::result::Result<(), std::fmt::Error>) = move _17; // scope 3 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/fmt/mod.rs:342:18: 342:87 + StorageDead(_19); // scope 3 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/fmt/mod.rs:342:86: 342:87 + StorageDead(_17); // scope 3 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/fmt/mod.rs:342:86: 342:87 + StorageDead(_16); // scope 1 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/fmt/mod.rs:323:33: 323:34 + StorageDead(_15); // scope 1 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/fmt/mod.rs:323:33: 323:34 + StorageDead(_11); // scope 0 at cheval.rs:2:30: 2:31 + _9 = [move _10]; // scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:28: 136:61 + StorageDead(_10); // scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:60: 136:61 + _8 = &_9; // scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:28: 136:61 + _7 = _8; // scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:28: 136:61 + _6 = move _7 as &[std::fmt::ArgumentV1<'_>] (Pointer(Unsize)); // scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:28: 136:61 + StorageDead(_7); // scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:60: 136:61 + _2 = Arguments::<'_>::new_v1(move _3, move _6) -> bb2; // scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:28: 136:61 + // mir::Constant + // + span: /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:28: 136:61 + // + user_ty: UserType(0) + // + literal: Const { ty: fn(&[&'static str], &[ArgumentV1<'_>]) -> Arguments<'_> {Arguments::<'_>::new_v1}, val: Value() } + } +} + +promoted[0] in main: &[&str; 2] = { + let mut _0: &[&str; 2]; // return place in scope 0 at cheval.rs:2:14: 2:18 + let mut _1: [&str; 2]; // in scope 0 at cheval.rs:2:14: 2:18 + + bb0: { + _1 = [const "", const "\n"]; // scope 0 at cheval.rs:2:14: 2:18 + // mir::Constant + // + span: cheval.rs:2:14: 2:18 + // + literal: Const { ty: &str, val: Value(Slice(..)) } + // mir::Constant + // + span: cheval.rs:2:14: 2:18 + // + literal: Const { ty: &str, val: Value(Slice(..)) } + _0 = &_1; // scope 0 at cheval.rs:2:14: 2:18 + return; // scope 0 at cheval.rs:2:14: 2:18 + } +} + +fn main_test() -> i64 { + let mut _0: i64; // return place in scope 0 at cheval.rs:6:19: 6:22 + let mut _1: [i64; 2]; // in scope 0 at cheval.rs:7:9: 7:16 + let _2: (); // in scope 0 at cheval.rs:8:5: 8:24 + let mut _3: &mut [i64]; // in scope 0 at cheval.rs:8:15: 8:23 + let mut _4: &mut [i64; 2]; // in scope 0 at cheval.rs:8:15: 8:23 + let mut _5: &mut [i64; 2]; // in scope 0 at cheval.rs:8:15: 8:23 + let _6: usize; // in scope 0 at cheval.rs:9:9: 9:10 + scope 1 { + debug arr => _1; // in scope 1 at cheval.rs:7:9: 7:16 + } + + bb0: { + StorageLive(_1); // scope 0 at cheval.rs:7:9: 7:16 + _1 = [const 1_i64, const 2_i64]; // scope 0 at cheval.rs:7:19: 7:26 + StorageLive(_2); // scope 1 at cheval.rs:8:5: 8:24 + StorageLive(_3); // scope 1 at cheval.rs:8:15: 8:23 + StorageLive(_4); // scope 1 at cheval.rs:8:15: 8:23 + StorageLive(_5); // scope 1 at cheval.rs:8:15: 8:23 + _5 = &mut _1; // scope 1 at cheval.rs:8:15: 8:23 + _4 = &mut (*_5); // scope 1 at cheval.rs:8:15: 8:23 + _3 = move _4 as &mut [i64] (Pointer(Unsize)); // scope 1 at cheval.rs:8:15: 8:23 + StorageDead(_4); // scope 1 at cheval.rs:8:22: 8:23 + _2 = fuse_test(move _3) -> bb1; // scope 1 at cheval.rs:8:5: 8:24 + // mir::Constant + // + span: cheval.rs:8:5: 8:14 + // + literal: Const { ty: for<'a> fn(&'a mut [i64]) {fuse_test}, val: Value() } + } + + bb1: { + StorageDead(_3); // scope 1 at cheval.rs:8:23: 8:24 + StorageDead(_5); // scope 1 at cheval.rs:8:24: 8:25 + StorageDead(_2); // scope 1 at cheval.rs:8:24: 8:25 + StorageLive(_6); // scope 1 at cheval.rs:9:9: 9:10 + _6 = const 0_usize; // scope 1 at cheval.rs:9:9: 9:10 + _0 = _1[_6]; // scope 1 at cheval.rs:9:5: 9:11 + StorageDead(_1); // scope 0 at cheval.rs:10:1: 10:2 + StorageDead(_6); // scope 0 at cheval.rs:10:1: 10:2 + return; // scope 0 at cheval.rs:10:2: 10:2 + } +} + +fn fuse_test(_1: &mut [i64]) -> () { + debug arr => _1; // in scope 0 at cheval.rs:12:14: 12:17 + let mut _0: (); // return place in scope 0 at cheval.rs:12:31: 12:31 + let _2: usize; // in scope 0 at cheval.rs:13:5: 19:17 + let mut _3: std::iter::Filter, [closure@cheval.rs:14:14: 14:17]>, [closure@cheval.rs:18:17: 18:20]>; // in scope 0 at cheval.rs:13:5: 18:34 + let mut _4: std::iter::Map, [closure@cheval.rs:14:14: 14:17]>; // in scope 0 at cheval.rs:13:5: 17:11 + let mut _5: std::slice::IterMut<'_, i64>; // in scope 0 at cheval.rs:13:5: 13:19 + let mut _6: &mut [i64]; // in scope 0 at cheval.rs:13:5: 13:19 + let mut _7: [closure@cheval.rs:14:14: 14:17]; // in scope 0 at cheval.rs:14:14: 17:10 + let mut _8: [closure@cheval.rs:18:17: 18:20]; // in scope 0 at cheval.rs:18:17: 18:33 + scope 1 (inlined core::slice::::iter_mut) { // at cheval.rs:13:5: 13:19 + debug self => _6; // in scope 1 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/slice/mod.rs:753:21: 753:30 + let mut _9: &mut [i64]; // in scope 1 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/slice/mod.rs:754:22: 754:26 + } + scope 2 (inlined as Iterator>::map::) { // at cheval.rs:13:5: 17:11 + debug self => _5; // in scope 2 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/iter/traits/iterator.rs:776:18: 776:22 + debug f => _7; // in scope 2 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/iter/traits/iterator.rs:776:24: 776:25 + let mut _10: std::slice::IterMut<'_, i64>; // in scope 2 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/iter/traits/iterator.rs:781:18: 781:22 + let mut _11: [closure@cheval.rs:14:14: 14:17]; // in scope 2 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/iter/traits/iterator.rs:781:24: 781:25 + scope 3 (inlined Map::, [closure@cheval.rs:14:14: 14:17]>::new) { // at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/iter/traits/iterator.rs:781:9: 781:26 + debug iter => _10; // in scope 3 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/iter/adapters/map.rs:68:32: 68:36 + debug f => _11; // in scope 3 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/iter/adapters/map.rs:68:41: 68:42 + let mut _12: std::slice::IterMut<'_, i64>; // in scope 3 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/iter/adapters/map.rs:69:15: 69:19 + } + } + scope 4 (inlined , [closure@cheval.rs:14:14: 14:17]> as Iterator>::filter::<[closure@cheval.rs:18:17: 18:20]>) { // at cheval.rs:13:5: 18:34 + debug self => _4; // in scope 4 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/iter/traits/iterator.rs:896:18: 896:22 + debug predicate => _8; // in scope 4 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/iter/traits/iterator.rs:896:24: 896:33 + let mut _13: std::iter::Map, [closure@cheval.rs:14:14: 14:17]>; // in scope 4 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/iter/traits/iterator.rs:901:21: 901:25 + let mut _14: [closure@cheval.rs:18:17: 18:20]; // in scope 4 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/iter/traits/iterator.rs:901:27: 901:36 + scope 5 (inlined Filter::, [closure@cheval.rs:14:14: 14:17]>, [closure@cheval.rs:18:17: 18:20]>::new) { // at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/iter/traits/iterator.rs:901:9: 901:37 + debug iter => _13; // in scope 5 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/iter/adapters/filter.rs:21:32: 21:36 + debug predicate => _14; // in scope 5 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/iter/adapters/filter.rs:21:41: 21:50 + let mut _15: std::iter::Map, [closure@cheval.rs:14:14: 14:17]>; // in scope 5 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/iter/adapters/filter.rs:22:18: 22:22 + } + } + + bb0: { + StorageLive(_2); // scope 0 at cheval.rs:13:5: 19:17 + StorageLive(_3); // scope 0 at cheval.rs:13:5: 18:34 + StorageLive(_4); // scope 0 at cheval.rs:13:5: 17:11 + StorageLive(_5); // scope 0 at cheval.rs:13:5: 13:19 + StorageLive(_6); // scope 0 at cheval.rs:13:5: 13:19 + _6 = &mut (*_1); // scope 0 at cheval.rs:13:5: 13:19 + StorageLive(_9); // scope 1 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/slice/mod.rs:754:22: 754:26 + _9 = &mut (*_6); // scope 1 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/slice/mod.rs:754:22: 754:26 + _5 = std::slice::IterMut::<'_, i64>::new(move _9) -> bb2; // scope 1 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/slice/mod.rs:754:9: 754:27 + // mir::Constant + // + span: /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/slice/mod.rs:754:9: 754:21 + // + user_ty: UserType(0) + // + literal: Const { ty: fn(&mut [i64]) -> std::slice::IterMut<'_, i64> {std::slice::IterMut::<'_, i64>::new}, val: Value() } + } + + bb1: { + StorageDead(_3); // scope 0 at cheval.rs:19:16: 19:17 + StorageDead(_2); // scope 0 at cheval.rs:19:17: 19:18 + return; // scope 0 at cheval.rs:20:2: 20:2 + } + + bb2: { + StorageDead(_9); // scope 1 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/slice/mod.rs:754:26: 754:27 + StorageDead(_6); // scope 0 at cheval.rs:13:18: 13:19 + StorageLive(_7); // scope 0 at cheval.rs:14:14: 17:10 + StorageLive(_10); // scope 2 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/iter/traits/iterator.rs:781:18: 781:22 + _10 = move _5; // scope 2 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/iter/traits/iterator.rs:781:18: 781:22 + StorageLive(_11); // scope 2 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/iter/traits/iterator.rs:781:24: 781:25 + StorageLive(_12); // scope 3 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/iter/adapters/map.rs:69:15: 69:19 + _12 = move _10; // scope 3 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/iter/adapters/map.rs:69:15: 69:19 + Deinit(_4); // scope 3 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/iter/adapters/map.rs:69:9: 69:24 + (_4.0: std::slice::IterMut<'_, i64>) = move _12; // scope 3 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/iter/adapters/map.rs:69:9: 69:24 + StorageDead(_12); // scope 3 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/iter/adapters/map.rs:69:23: 69:24 + StorageDead(_11); // scope 2 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/iter/traits/iterator.rs:781:25: 781:26 + StorageDead(_10); // scope 2 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/iter/traits/iterator.rs:781:25: 781:26 + StorageDead(_7); // scope 0 at cheval.rs:17:10: 17:11 + StorageDead(_5); // scope 0 at cheval.rs:17:10: 17:11 + StorageLive(_8); // scope 0 at cheval.rs:18:17: 18:33 + StorageLive(_13); // scope 4 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/iter/traits/iterator.rs:901:21: 901:25 + _13 = move _4; // scope 4 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/iter/traits/iterator.rs:901:21: 901:25 + StorageLive(_14); // scope 4 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/iter/traits/iterator.rs:901:27: 901:36 + StorageLive(_15); // scope 5 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/iter/adapters/filter.rs:22:18: 22:22 + _15 = move _13; // scope 5 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/iter/adapters/filter.rs:22:18: 22:22 + Deinit(_3); // scope 5 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/iter/adapters/filter.rs:22:9: 22:35 + (_3.0: std::iter::Map, [closure@cheval.rs:14:14: 14:17]>) = move _15; // scope 5 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/iter/adapters/filter.rs:22:9: 22:35 + StorageDead(_15); // scope 5 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/iter/adapters/filter.rs:22:34: 22:35 + StorageDead(_14); // scope 4 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/iter/traits/iterator.rs:901:36: 901:37 + StorageDead(_13); // scope 4 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/core/src/iter/traits/iterator.rs:901:36: 901:37 + StorageDead(_8); // scope 0 at cheval.rs:18:33: 18:34 + StorageDead(_4); // scope 0 at cheval.rs:18:33: 18:34 + _2 = , [closure@cheval.rs:14:14: 14:17]>, [closure@cheval.rs:18:17: 18:20]> as Iterator>::count(move _3) -> bb1; // scope 0 at cheval.rs:13:5: 19:17 + // mir::Constant + // + span: cheval.rs:19:10: 19:15 + // + literal: Const { ty: fn(Filter, [closure@cheval.rs:14:14: 14:17]>, [closure@cheval.rs:18:17: 18:20]>) -> usize {, [closure@cheval.rs:14:14: 14:17]>, [closure@cheval.rs:18:17: 18:20]> as Iterator>::count}, val: Value() } + } +} + +fn fuse_test::{closure#0}(_1: &mut [closure@cheval.rs:14:14: 14:17], _2: &mut i64) -> i64 { + debug e => _2; // in scope 0 at cheval.rs:14:15: 14:16 + let mut _0: i64; // return place in scope 0 at cheval.rs:14:18: 14:18 + let mut _3: i64; // in scope 0 at cheval.rs:15:18: 15:20 + + bb0: { + StorageLive(_3); // scope 0 at cheval.rs:15:18: 15:20 + _3 = (*_2); // scope 0 at cheval.rs:15:18: 15:20 + (*_2) = Mul(move _3, const 5_i64); // scope 0 at cheval.rs:15:13: 15:24 + StorageDead(_3); // scope 0 at cheval.rs:15:23: 15:24 + _0 = (*_2); // scope 0 at cheval.rs:16:13: 16:15 + return; // scope 0 at cheval.rs:17:10: 17:10 + } +} + +fn fuse_test::{closure#1}(_1: &mut [closure@cheval.rs:18:17: 18:20], _2: &i64) -> bool { + debug e => _2; // in scope 0 at cheval.rs:18:18: 18:19 + let mut _0: bool; // return place in scope 0 at cheval.rs:18:21: 18:21 + let mut _3: i64; // in scope 0 at cheval.rs:18:21: 18:28 + let mut _4: i64; // in scope 0 at cheval.rs:18:21: 18:23 + let mut _5: bool; // in scope 0 at cheval.rs:18:21: 18:28 + let mut _6: bool; // in scope 0 at cheval.rs:18:21: 18:28 + + bb0: { + StorageLive(_3); // scope 0 at cheval.rs:18:21: 18:28 + StorageLive(_4); // scope 0 at cheval.rs:18:21: 18:23 + _4 = (*_2); // scope 0 at cheval.rs:18:21: 18:23 + _5 = Eq(_4, const i64::MIN); // scope 0 at cheval.rs:18:21: 18:28 + _6 = BitAnd(const false, move _5); // scope 0 at cheval.rs:18:21: 18:28 + assert(!move _6, "attempt to compute the remainder of `{} % {}`, which would overflow", _4, const 10_i64) -> bb1; // scope 0 at cheval.rs:18:21: 18:28 + } + + bb1: { + _3 = Rem(move _4, const 10_i64); // scope 0 at cheval.rs:18:21: 18:28 + StorageDead(_4); // scope 0 at cheval.rs:18:27: 18:28 + _0 = Eq(move _3, const 0_i64); // scope 0 at cheval.rs:18:21: 18:33 + StorageDead(_3); // scope 0 at cheval.rs:18:32: 18:33 + return; // scope 0 at cheval.rs:18:33: 18:33 + } +} diff --git a/cheval.mir.unopt b/cheval.mir.unopt new file mode 100644 index 0000000..0924d9b --- /dev/null +++ b/cheval.mir.unopt @@ -0,0 +1,276 @@ +// WARNING: This output format is intended for human consumers only +// and is subject to change without notice. Knock yourself out. +fn main() -> () { + let mut _0: (); // return place in scope 0 at cheval.rs:1:16: 1:16 + let _1: (); // in scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:135:23: 137:6 + let _2: (); // in scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:9: 136:62 + let mut _3: std::fmt::Arguments<'_>; // in scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:28: 136:61 + let mut _4: &[&str]; // in scope 0 at cheval.rs:2:14: 2:18 + let mut _5: &[&str; 2]; // in scope 0 at cheval.rs:2:14: 2:18 + let _6: &[&str; 2]; // in scope 0 at cheval.rs:2:14: 2:18 + let _7: [&str; 2]; // in scope 0 at cheval.rs:2:14: 2:18 + let mut _8: &[std::fmt::ArgumentV1<'_>]; // in scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:28: 136:61 + let mut _9: &[std::fmt::ArgumentV1<'_>; 1]; // in scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:28: 136:61 + let _10: &[std::fmt::ArgumentV1<'_>; 1]; // in scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:28: 136:61 + let _11: [std::fmt::ArgumentV1<'_>; 1]; // in scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:28: 136:61 + let mut _12: std::fmt::ArgumentV1<'_>; // in scope 0 at cheval.rs:2:20: 2:31 + let mut _13: &i64; // in scope 0 at cheval.rs:2:20: 2:31 + let _14: &i64; // in scope 0 at cheval.rs:2:20: 2:31 + let _15: i64; // in scope 0 at cheval.rs:2:20: 2:31 + let mut _16: &[&str; 2]; // in scope 0 at cheval.rs:2:14: 2:18 + + bb0: { + StorageLive(_1); // scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:135:23: 137:6 + StorageLive(_2); // scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:9: 136:62 + StorageLive(_3); // scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:28: 136:61 + StorageLive(_4); // scope 0 at cheval.rs:2:14: 2:18 + StorageLive(_5); // scope 0 at cheval.rs:2:14: 2:18 + StorageLive(_6); // scope 0 at cheval.rs:2:14: 2:18 + _16 = const _; // scope 0 at cheval.rs:2:14: 2:18 + // mir::Constant + // + span: cheval.rs:2:14: 2:18 + // + literal: Const { ty: &[&str; 2], val: Unevaluated(main, [], Some(promoted[0])) } + _6 = &(*_16); // scope 0 at cheval.rs:2:14: 2:18 + _5 = &(*_6); // scope 0 at cheval.rs:2:14: 2:18 + _4 = move _5 as &[&str] (Pointer(Unsize)); // scope 0 at cheval.rs:2:14: 2:18 + StorageDead(_5); // scope 0 at cheval.rs:2:17: 2:18 + StorageLive(_8); // scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:28: 136:61 + StorageLive(_9); // scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:28: 136:61 + StorageLive(_10); // scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:28: 136:61 + StorageLive(_11); // scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:28: 136:61 + StorageLive(_12); // scope 0 at cheval.rs:2:20: 2:31 + StorageLive(_13); // scope 0 at cheval.rs:2:20: 2:31 + StorageLive(_14); // scope 0 at cheval.rs:2:20: 2:31 + StorageLive(_15); // scope 0 at cheval.rs:2:20: 2:31 + _15 = main_test() -> bb1; // scope 0 at cheval.rs:2:20: 2:31 + // mir::Constant + // + span: cheval.rs:2:20: 2:29 + // + literal: Const { ty: fn() -> i64 {main_test}, val: Value() } + } + + bb1: { + _14 = &_15; // scope 0 at cheval.rs:2:20: 2:31 + _13 = &(*_14); // scope 0 at cheval.rs:2:20: 2:31 + _12 = ArgumentV1::<'_>::new_display::(move _13) -> bb2; // scope 0 at cheval.rs:2:20: 2:31 + // mir::Constant + // + span: cheval.rs:2:20: 2:31 + // + user_ty: UserType(1) + // + literal: Const { ty: for<'b> fn(&'b i64) -> ArgumentV1<'b> {ArgumentV1::<'_>::new_display::}, val: Value() } + } + + bb2: { + StorageDead(_13); // scope 0 at cheval.rs:2:30: 2:31 + _11 = [move _12]; // scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:28: 136:61 + StorageDead(_12); // scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:60: 136:61 + _10 = &_11; // scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:28: 136:61 + _9 = &(*_10); // scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:28: 136:61 + _8 = move _9 as &[std::fmt::ArgumentV1<'_>] (Pointer(Unsize)); // scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:28: 136:61 + StorageDead(_9); // scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:60: 136:61 + _3 = Arguments::<'_>::new_v1(move _4, move _8) -> bb3; // scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:28: 136:61 + // mir::Constant + // + span: /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:28: 136:61 + // + user_ty: UserType(0) + // + literal: Const { ty: fn(&[&'static str], &[ArgumentV1<'_>]) -> Arguments<'_> {Arguments::<'_>::new_v1}, val: Value() } + } + + bb3: { + StorageDead(_8); // scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:60: 136:61 + StorageDead(_4); // scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:60: 136:61 + _2 = _print(move _3) -> bb4; // scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:9: 136:62 + // mir::Constant + // + span: /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:9: 136:27 + // + literal: Const { ty: for<'a> fn(Arguments<'a>) {_print}, val: Value() } + } + + bb4: { + StorageDead(_3); // scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:61: 136:62 + StorageDead(_15); // scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:62: 136:63 + StorageDead(_14); // scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:62: 136:63 + StorageDead(_11); // scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:62: 136:63 + StorageDead(_10); // scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:62: 136:63 + StorageDead(_6); // scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:62: 136:63 + StorageDead(_2); // scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:136:62: 136:63 + _1 = const (); // scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:135:23: 137:6 + StorageDead(_1); // scope 0 at /rustc/6284998a2677d7e3e8420db783f3aa4fd80d7423/library/std/src/macros.rs:137:5: 137:6 + _0 = const (); // scope 0 at cheval.rs:1:16: 3:2 + return; // scope 0 at cheval.rs:3:2: 3:2 + } +} + +promoted[0] in main: &[&str; 2] = { + let mut _0: &[&str; 2]; // return place in scope 0 at cheval.rs:2:14: 2:18 + let mut _1: [&str; 2]; // in scope 0 at cheval.rs:2:14: 2:18 + + bb0: { + _1 = [const "", const "\n"]; // scope 0 at cheval.rs:2:14: 2:18 + // mir::Constant + // + span: cheval.rs:2:14: 2:18 + // + literal: Const { ty: &str, val: Value(Slice(..)) } + // mir::Constant + // + span: cheval.rs:2:14: 2:18 + // + literal: Const { ty: &str, val: Value(Slice(..)) } + _0 = &_1; // scope 0 at cheval.rs:2:14: 2:18 + return; // scope 0 at cheval.rs:2:14: 2:18 + } +} + +fn main_test() -> i64 { + let mut _0: i64; // return place in scope 0 at cheval.rs:6:19: 6:22 + let mut _1: [i64; 2]; // in scope 0 at cheval.rs:7:9: 7:16 + let _2: (); // in scope 0 at cheval.rs:8:5: 8:24 + let mut _3: &mut [i64]; // in scope 0 at cheval.rs:8:15: 8:23 + let mut _4: &mut [i64; 2]; // in scope 0 at cheval.rs:8:15: 8:23 + let mut _5: &mut [i64; 2]; // in scope 0 at cheval.rs:8:15: 8:23 + let _6: usize; // in scope 0 at cheval.rs:9:9: 9:10 + let mut _7: usize; // in scope 0 at cheval.rs:9:5: 9:11 + let mut _8: bool; // in scope 0 at cheval.rs:9:5: 9:11 + scope 1 { + debug arr => _1; // in scope 1 at cheval.rs:7:9: 7:16 + } + + bb0: { + StorageLive(_1); // scope 0 at cheval.rs:7:9: 7:16 + _1 = [const 1_i64, const 2_i64]; // scope 0 at cheval.rs:7:19: 7:26 + StorageLive(_2); // scope 1 at cheval.rs:8:5: 8:24 + StorageLive(_3); // scope 1 at cheval.rs:8:15: 8:23 + StorageLive(_4); // scope 1 at cheval.rs:8:15: 8:23 + StorageLive(_5); // scope 1 at cheval.rs:8:15: 8:23 + _5 = &mut _1; // scope 1 at cheval.rs:8:15: 8:23 + _4 = &mut (*_5); // scope 1 at cheval.rs:8:15: 8:23 + _3 = move _4 as &mut [i64] (Pointer(Unsize)); // scope 1 at cheval.rs:8:15: 8:23 + StorageDead(_4); // scope 1 at cheval.rs:8:22: 8:23 + _2 = fuse_test(move _3) -> bb1; // scope 1 at cheval.rs:8:5: 8:24 + // mir::Constant + // + span: cheval.rs:8:5: 8:14 + // + literal: Const { ty: for<'a> fn(&'a mut [i64]) {fuse_test}, val: Value() } + } + + bb1: { + StorageDead(_3); // scope 1 at cheval.rs:8:23: 8:24 + StorageDead(_5); // scope 1 at cheval.rs:8:24: 8:25 + StorageDead(_2); // scope 1 at cheval.rs:8:24: 8:25 + StorageLive(_6); // scope 1 at cheval.rs:9:9: 9:10 + _6 = const 0_usize; // scope 1 at cheval.rs:9:9: 9:10 + _7 = Len(_1); // scope 1 at cheval.rs:9:5: 9:11 + _8 = Lt(_6, _7); // scope 1 at cheval.rs:9:5: 9:11 + assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> bb2; // scope 1 at cheval.rs:9:5: 9:11 + } + + bb2: { + _0 = _1[_6]; // scope 1 at cheval.rs:9:5: 9:11 + StorageDead(_1); // scope 0 at cheval.rs:10:1: 10:2 + StorageDead(_6); // scope 0 at cheval.rs:10:1: 10:2 + return; // scope 0 at cheval.rs:10:2: 10:2 + } +} + +fn fuse_test(_1: &mut [i64]) -> () { + debug arr => _1; // in scope 0 at cheval.rs:12:14: 12:17 + let mut _0: (); // return place in scope 0 at cheval.rs:12:31: 12:31 + let _2: usize; // in scope 0 at cheval.rs:13:5: 19:17 + let mut _3: std::iter::Filter, [closure@cheval.rs:14:14: 14:17]>, [closure@cheval.rs:18:17: 18:20]>; // in scope 0 at cheval.rs:13:5: 18:34 + let mut _4: std::iter::Map, [closure@cheval.rs:14:14: 14:17]>; // in scope 0 at cheval.rs:13:5: 17:11 + let mut _5: std::slice::IterMut<'_, i64>; // in scope 0 at cheval.rs:13:5: 13:19 + let mut _6: &mut [i64]; // in scope 0 at cheval.rs:13:5: 13:19 + let mut _7: [closure@cheval.rs:14:14: 14:17]; // in scope 0 at cheval.rs:14:14: 17:10 + let mut _8: [closure@cheval.rs:18:17: 18:20]; // in scope 0 at cheval.rs:18:17: 18:33 + + bb0: { + StorageLive(_2); // scope 0 at cheval.rs:13:5: 19:17 + StorageLive(_3); // scope 0 at cheval.rs:13:5: 18:34 + StorageLive(_4); // scope 0 at cheval.rs:13:5: 17:11 + StorageLive(_5); // scope 0 at cheval.rs:13:5: 13:19 + StorageLive(_6); // scope 0 at cheval.rs:13:5: 13:19 + _6 = &mut (*_1); // scope 0 at cheval.rs:13:5: 13:19 + _5 = core::slice::::iter_mut(move _6) -> bb1; // scope 0 at cheval.rs:13:5: 13:19 + // mir::Constant + // + span: cheval.rs:13:9: 13:17 + // + literal: Const { ty: for<'a> fn(&'a mut [i64]) -> std::slice::IterMut<'a, i64> {core::slice::::iter_mut}, val: Value() } + } + + bb1: { + StorageDead(_6); // scope 0 at cheval.rs:13:18: 13:19 + StorageLive(_7); // scope 0 at cheval.rs:14:14: 17:10 + Deinit(_7); // scope 0 at cheval.rs:14:14: 17:10 + _4 = as Iterator>::map::(move _5, move _7) -> bb2; // scope 0 at cheval.rs:13:5: 17:11 + // mir::Constant + // + span: cheval.rs:14:10: 14:13 + // + literal: Const { ty: fn(std::slice::IterMut<'_, i64>, [closure@cheval.rs:14:14: 14:17]) -> Map, [closure@cheval.rs:14:14: 14:17]> { as Iterator>::map::}, val: Value() } + } + + bb2: { + StorageDead(_7); // scope 0 at cheval.rs:17:10: 17:11 + StorageDead(_5); // scope 0 at cheval.rs:17:10: 17:11 + StorageLive(_8); // scope 0 at cheval.rs:18:17: 18:33 + Deinit(_8); // scope 0 at cheval.rs:18:17: 18:33 + _3 = , [closure@cheval.rs:14:14: 14:17]> as Iterator>::filter::<[closure@cheval.rs:18:17: 18:20]>(move _4, move _8) -> bb3; // scope 0 at cheval.rs:13:5: 18:34 + // mir::Constant + // + span: cheval.rs:18:10: 18:16 + // + literal: Const { ty: fn(Map, [closure@cheval.rs:14:14: 14:17]>, [closure@cheval.rs:18:17: 18:20]) -> Filter, [closure@cheval.rs:14:14: 14:17]>, [closure@cheval.rs:18:17: 18:20]> {, [closure@cheval.rs:14:14: 14:17]> as Iterator>::filter::<[closure@cheval.rs:18:17: 18:20]>}, val: Value() } + } + + bb3: { + StorageDead(_8); // scope 0 at cheval.rs:18:33: 18:34 + StorageDead(_4); // scope 0 at cheval.rs:18:33: 18:34 + _2 = , [closure@cheval.rs:14:14: 14:17]>, [closure@cheval.rs:18:17: 18:20]> as Iterator>::count(move _3) -> bb4; // scope 0 at cheval.rs:13:5: 19:17 + // mir::Constant + // + span: cheval.rs:19:10: 19:15 + // + literal: Const { ty: fn(Filter, [closure@cheval.rs:14:14: 14:17]>, [closure@cheval.rs:18:17: 18:20]>) -> usize {, [closure@cheval.rs:14:14: 14:17]>, [closure@cheval.rs:18:17: 18:20]> as Iterator>::count}, val: Value() } + } + + bb4: { + StorageDead(_3); // scope 0 at cheval.rs:19:16: 19:17 + StorageDead(_2); // scope 0 at cheval.rs:19:17: 19:18 + _0 = const (); // scope 0 at cheval.rs:12:31: 20:2 + return; // scope 0 at cheval.rs:20:2: 20:2 + } +} + +fn fuse_test::{closure#0}(_1: &mut [closure@cheval.rs:14:14: 14:17], _2: &mut i64) -> i64 { + debug e => _2; // in scope 0 at cheval.rs:14:15: 14:16 + let mut _0: i64; // return place in scope 0 at cheval.rs:14:18: 14:18 + let mut _3: i64; // in scope 0 at cheval.rs:15:18: 15:20 + + bb0: { + StorageLive(_3); // scope 0 at cheval.rs:15:18: 15:20 + _3 = (*_2); // scope 0 at cheval.rs:15:18: 15:20 + (*_2) = Mul(move _3, const 5_i64); // scope 0 at cheval.rs:15:13: 15:24 + StorageDead(_3); // scope 0 at cheval.rs:15:23: 15:24 + _0 = (*_2); // scope 0 at cheval.rs:16:13: 16:15 + return; // scope 0 at cheval.rs:17:10: 17:10 + } +} + +fn fuse_test::{closure#1}(_1: &mut [closure@cheval.rs:18:17: 18:20], _2: &i64) -> bool { + debug e => _2; // in scope 0 at cheval.rs:18:18: 18:19 + let mut _0: bool; // return place in scope 0 at cheval.rs:18:21: 18:21 + let mut _3: i64; // in scope 0 at cheval.rs:18:21: 18:28 + let mut _4: i64; // in scope 0 at cheval.rs:18:21: 18:23 + let mut _5: bool; // in scope 0 at cheval.rs:18:21: 18:28 + let mut _6: bool; // in scope 0 at cheval.rs:18:21: 18:28 + let mut _7: bool; // in scope 0 at cheval.rs:18:21: 18:28 + let mut _8: bool; // in scope 0 at cheval.rs:18:21: 18:28 + + bb0: { + StorageLive(_3); // scope 0 at cheval.rs:18:21: 18:28 + StorageLive(_4); // scope 0 at cheval.rs:18:21: 18:23 + _4 = (*_2); // scope 0 at cheval.rs:18:21: 18:23 + _5 = Eq(const 10_i64, const 0_i64); // scope 0 at cheval.rs:18:21: 18:28 + assert(!move _5, "attempt to calculate the remainder of `{}` with a divisor of zero", _4) -> bb1; // scope 0 at cheval.rs:18:21: 18:28 + } + + bb1: { + _6 = Eq(const 10_i64, const -1_i64); // scope 0 at cheval.rs:18:21: 18:28 + _7 = Eq(_4, const i64::MIN); // scope 0 at cheval.rs:18:21: 18:28 + _8 = BitAnd(move _6, move _7); // scope 0 at cheval.rs:18:21: 18:28 + assert(!move _8, "attempt to compute the remainder of `{} % {}`, which would overflow", _4, const 10_i64) -> bb2; // scope 0 at cheval.rs:18:21: 18:28 + } + + bb2: { + _3 = Rem(move _4, const 10_i64); // scope 0 at cheval.rs:18:21: 18:28 + StorageDead(_4); // scope 0 at cheval.rs:18:27: 18:28 + _0 = Eq(move _3, const 0_i64); // scope 0 at cheval.rs:18:21: 18:33 + StorageDead(_3); // scope 0 at cheval.rs:18:32: 18:33 + return; // scope 0 at cheval.rs:18:33: 18:33 + } +} diff --git a/cheval.rs b/cheval.rs new file mode 100644 index 0000000..7aa37c3 --- /dev/null +++ b/cheval.rs @@ -0,0 +1,20 @@ +pub fn main () { + println!("{}", main_test()); +} + +#[inline(never)] +fn main_test() -> i64 { + let mut arr = [ 1, 2]; + fuse_test(&mut arr); + arr[0] +} + +fn fuse_test(arr: &mut [i64]) { + arr.iter_mut() + .map(|e| { + *e = *e * 5; + *e + }) + .filter(|e| *e % 10 == 0) + .count(); +} diff --git a/cheval.s b/cheval.s new file mode 100644 index 0000000..dfa96e6 --- /dev/null +++ b/cheval.s @@ -0,0 +1,181 @@ + .text + .file "cheval.434b2442-cgu.0" + .section .text._ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17h41f8b7da52e89b98E,"ax",@progbits + .p2align 4, 0x90 + .type _ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17h41f8b7da52e89b98E,@function +_ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17h41f8b7da52e89b98E: + .cfi_startproc + pushq %rax + .cfi_def_cfa_offset 16 + callq *%rdi + #APP + #NO_APP + popq %rax + .cfi_def_cfa_offset 8 + retq +.Lfunc_end0: + .size _ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17h41f8b7da52e89b98E, .Lfunc_end0-_ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17h41f8b7da52e89b98E + .cfi_endproc + + .section .text._ZN3std2rt10lang_start17he131ba9074e25360E,"ax",@progbits + .hidden _ZN3std2rt10lang_start17he131ba9074e25360E + .globl _ZN3std2rt10lang_start17he131ba9074e25360E + .p2align 4, 0x90 + .type _ZN3std2rt10lang_start17he131ba9074e25360E,@function +_ZN3std2rt10lang_start17he131ba9074e25360E: + .cfi_startproc + pushq %rax + .cfi_def_cfa_offset 16 + movq %rdx, %rcx + movq %rsi, %rdx + movq %rdi, (%rsp) + leaq .L__unnamed_1(%rip), %rsi + movq %rsp, %rdi + callq *_ZN3std2rt19lang_start_internal17h09bcc9fffd987f14E@GOTPCREL(%rip) + popq %rcx + .cfi_def_cfa_offset 8 + retq +.Lfunc_end1: + .size _ZN3std2rt10lang_start17he131ba9074e25360E, .Lfunc_end1-_ZN3std2rt10lang_start17he131ba9074e25360E + .cfi_endproc + + .section ".text._ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17h4d50961104610955E","ax",@progbits + .p2align 4, 0x90 + .type _ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17h4d50961104610955E,@function +_ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17h4d50961104610955E: + .cfi_startproc + pushq %rax + .cfi_def_cfa_offset 16 + movq (%rdi), %rdi + callq _ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17h41f8b7da52e89b98E + xorl %eax, %eax + popq %rcx + .cfi_def_cfa_offset 8 + retq +.Lfunc_end2: + .size _ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17h4d50961104610955E, .Lfunc_end2-_ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17h4d50961104610955E + .cfi_endproc + + .section ".text._ZN4core3ops8function6FnOnce40call_once$u7b$$u7b$vtable.shim$u7d$$u7d$17h59ddb332eff5b283E","ax",@progbits + .p2align 4, 0x90 + .type _ZN4core3ops8function6FnOnce40call_once$u7b$$u7b$vtable.shim$u7d$$u7d$17h59ddb332eff5b283E,@function +_ZN4core3ops8function6FnOnce40call_once$u7b$$u7b$vtable.shim$u7d$$u7d$17h59ddb332eff5b283E: + .cfi_startproc + pushq %rax + .cfi_def_cfa_offset 16 + movq (%rdi), %rdi + callq _ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17h41f8b7da52e89b98E + xorl %eax, %eax + popq %rcx + .cfi_def_cfa_offset 8 + retq +.Lfunc_end3: + .size _ZN4core3ops8function6FnOnce40call_once$u7b$$u7b$vtable.shim$u7d$$u7d$17h59ddb332eff5b283E, .Lfunc_end3-_ZN4core3ops8function6FnOnce40call_once$u7b$$u7b$vtable.shim$u7d$$u7d$17h59ddb332eff5b283E + .cfi_endproc + + .section ".text._ZN4core3ptr85drop_in_place$LT$std..rt..lang_start$LT$$LP$$RP$$GT$..$u7b$$u7b$closure$u7d$$u7d$$GT$17h329c60c5ef7796efE","ax",@progbits + .p2align 4, 0x90 + .type _ZN4core3ptr85drop_in_place$LT$std..rt..lang_start$LT$$LP$$RP$$GT$..$u7b$$u7b$closure$u7d$$u7d$$GT$17h329c60c5ef7796efE,@function +_ZN4core3ptr85drop_in_place$LT$std..rt..lang_start$LT$$LP$$RP$$GT$..$u7b$$u7b$closure$u7d$$u7d$$GT$17h329c60c5ef7796efE: + .cfi_startproc + retq +.Lfunc_end4: + .size _ZN4core3ptr85drop_in_place$LT$std..rt..lang_start$LT$$LP$$RP$$GT$..$u7b$$u7b$closure$u7d$$u7d$$GT$17h329c60c5ef7796efE, .Lfunc_end4-_ZN4core3ptr85drop_in_place$LT$std..rt..lang_start$LT$$LP$$RP$$GT$..$u7b$$u7b$closure$u7d$$u7d$$GT$17h329c60c5ef7796efE + .cfi_endproc + + .section .text._ZN6cheval4main17hb27520a1fe33142bE,"ax",@progbits + .p2align 4, 0x90 + .type _ZN6cheval4main17hb27520a1fe33142bE,@function +_ZN6cheval4main17hb27520a1fe33142bE: + .cfi_startproc + subq $72, %rsp + .cfi_def_cfa_offset 80 + callq _ZN6cheval9main_test17h920cf553da9b6fa6E + movq %rax, (%rsp) + movq %rsp, %rax + movq %rax, 8(%rsp) + movq _ZN4core3fmt3num3imp52_$LT$impl$u20$core..fmt..Display$u20$for$u20$i64$GT$3fmt17h7f25baa19e0cd7d8E@GOTPCREL(%rip), %rax + movq %rax, 16(%rsp) + leaq .L__unnamed_2(%rip), %rax + movq %rax, 24(%rsp) + movq $2, 32(%rsp) + movq $0, 40(%rsp) + leaq 8(%rsp), %rax + movq %rax, 56(%rsp) + movq $1, 64(%rsp) + leaq 24(%rsp), %rdi + callq *_ZN3std2io5stdio6_print17hdb1c1fab578c3488E@GOTPCREL(%rip) + addq $72, %rsp + .cfi_def_cfa_offset 8 + retq +.Lfunc_end5: + .size _ZN6cheval4main17hb27520a1fe33142bE, .Lfunc_end5-_ZN6cheval4main17hb27520a1fe33142bE + .cfi_endproc + + .section .text._ZN6cheval9main_test17h920cf553da9b6fa6E,"ax",@progbits + .p2align 4, 0x90 + .type _ZN6cheval9main_test17h920cf553da9b6fa6E,@function +_ZN6cheval9main_test17h920cf553da9b6fa6E: + .cfi_startproc + movl $5, %eax + retq +.Lfunc_end6: + .size _ZN6cheval9main_test17h920cf553da9b6fa6E, .Lfunc_end6-_ZN6cheval9main_test17h920cf553da9b6fa6E + .cfi_endproc + + .section .text.main,"ax",@progbits + .globl main + .p2align 4, 0x90 + .type main,@function +main: + .cfi_startproc + pushq %rax + .cfi_def_cfa_offset 16 + movq %rsi, %rcx + movslq %edi, %rdx + leaq _ZN6cheval4main17hb27520a1fe33142bE(%rip), %rax + movq %rax, (%rsp) + leaq .L__unnamed_1(%rip), %rsi + movq %rsp, %rdi + callq *_ZN3std2rt19lang_start_internal17h09bcc9fffd987f14E@GOTPCREL(%rip) + popq %rcx + .cfi_def_cfa_offset 8 + retq +.Lfunc_end7: + .size main, .Lfunc_end7-main + .cfi_endproc + + .type .L__unnamed_1,@object + .section .data.rel.ro..L__unnamed_1,"aw",@progbits + .p2align 3 +.L__unnamed_1: + .quad _ZN4core3ptr85drop_in_place$LT$std..rt..lang_start$LT$$LP$$RP$$GT$..$u7b$$u7b$closure$u7d$$u7d$$GT$17h329c60c5ef7796efE + .asciz "\b\000\000\000\000\000\000\000\b\000\000\000\000\000\000" + .quad _ZN4core3ops8function6FnOnce40call_once$u7b$$u7b$vtable.shim$u7d$$u7d$17h59ddb332eff5b283E + .quad _ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17h4d50961104610955E + .quad _ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17h4d50961104610955E + .size .L__unnamed_1, 48 + + .type .L__unnamed_3,@object + .section .rodata..L__unnamed_3,"a",@progbits + .p2align 3 +.L__unnamed_3: + .size .L__unnamed_3, 0 + + .type .L__unnamed_4,@object + .section .rodata..L__unnamed_4,"a",@progbits +.L__unnamed_4: + .byte 10 + .size .L__unnamed_4, 1 + + .type .L__unnamed_2,@object + .section .data.rel.ro..L__unnamed_2,"aw",@progbits + .p2align 3 +.L__unnamed_2: + .quad .L__unnamed_3 + .zero 8 + .quad .L__unnamed_4 + .asciz "\001\000\000\000\000\000\000" + .size .L__unnamed_2, 32 + + .section ".note.GNU-stack","",@progbits