Skip to content

Instantly share code, notes, and snippets.

@DemiMarie
Created December 19, 2016 18:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DemiMarie/194a3ed70616ed76f021eb5414d21d4d to your computer and use it in GitHub Desktop.
Save DemiMarie/194a3ed70616ed76f021eb5414d21d4d to your computer and use it in GitHub Desktop.
Odd-looking MIR and LLVM IR
; ModuleID = 'become.cgu-0.rs'
source_filename = "become.cgu-0.rs"
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
%str_slice = type { i8*, i64 }
%VerboseDrop = type { {} }
%"core::fmt::ArgumentV1" = type { %"core::fmt::Void"*, i8 (%"core::fmt::Void"*, %"core::fmt::Formatter"*)* }
%"core::fmt::Void" = type { {} }
%"core::fmt::Formatter" = type { %"core::option::Option", %"core::option::Option", { i8*, void (i8*)** }, %"core::slice::Iter", { %"core::fmt::ArgumentV1"*, i64 }, i32, i32, i8 }
%"core::option::Option" = type { i64, [0 x i64], [1 x i64] }
%"core::slice::Iter" = type { %"core::fmt::ArgumentV1"*, %"core::fmt::ArgumentV1"*, %"core::marker::PhantomData<&core::fmt::ArgumentV1>" }
%"core::marker::PhantomData<&core::fmt::ArgumentV1>" = type {}
%"core::fmt::Arguments" = type { { %str_slice*, i64 }, %"core::option::Option<&[core::fmt::rt::v1::Argument]>", { %"core::fmt::ArgumentV1"*, i64 } }
%"core::option::Option<&[core::fmt::rt::v1::Argument]>" = type { { %"core::fmt::rt::v1::Argument"*, i64 } }
%"core::fmt::rt::v1::Argument" = type { %"core::fmt::rt::v1::Position", %"core::fmt::rt::v1::FormatSpec" }
%"core::fmt::rt::v1::Position" = type { i64, [0 x i64], [1 x i64] }
%"core::fmt::rt::v1::FormatSpec" = type { %"core::fmt::rt::v1::Count", %"core::fmt::rt::v1::Count", i32, i32, i8 }
%"core::fmt::rt::v1::Count" = type { i64, [0 x i64], [1 x i64] }
%"unwind::libunwind::_Unwind_Exception" = type { i64, void (i32, %"unwind::libunwind::_Unwind_Exception"*)*, [6 x i64] }
%"unwind::libunwind::_Unwind_Context" = type {}
@_ZN6become4main15__STATIC_FMTSTR17h029dfc57aaf27f81E = internal constant { %str_slice*, i64 } { %str_slice* getelementptr inbounds ([2 x %str_slice], [2 x %str_slice]* @ref.8, i32 0, i32 0), i64 2 }, align 8
@_ZN6become4main15__STATIC_FMTSTR17h3639e0ebacaa7deaE = internal constant { %str_slice*, i64 } { %str_slice* getelementptr inbounds ([2 x %str_slice], [2 x %str_slice]* @ref.8, i32 0, i32 0), i64 2 }, align 8
@str.0 = internal constant [9 x i8] c"become.rs"
@str.1 = internal constant [33 x i8] c"attempt to subtract with overflow"
@panic_loc.2 = internal unnamed_addr constant { %str_slice, %str_slice, i32 } { %str_slice { i8* getelementptr inbounds ([33 x i8], [33 x i8]* @str.1, i32 0, i32 0), i64 33 }, %str_slice { i8* getelementptr inbounds ([9 x i8], [9 x i8]* @str.0, i32 0, i32 0), i64 9 }, i32 20 }, align 8
@str.3 = internal constant [28 x i8] c"attempt to add with overflow"
@panic_loc.4 = internal unnamed_addr constant { %str_slice, %str_slice, i32 } { %str_slice { i8* getelementptr inbounds ([28 x i8], [28 x i8]* @str.3, i32 0, i32 0), i64 28 }, %str_slice { i8* getelementptr inbounds ([9 x i8], [9 x i8]* @str.0, i32 0, i32 0), i64 9 }, i32 20 }, align 8
@ref.5 = internal unnamed_addr constant i32 1000, align 4
@str.6 = internal constant [0 x i8] zeroinitializer
@str.7 = internal constant [1 x i8] c"\0A"
@ref.8 = internal unnamed_addr constant [2 x %str_slice] [%str_slice { i8* getelementptr inbounds ([0 x i8], [0 x i8]* @str.6, i32 0, i32 0), i64 0 }, %str_slice { i8* getelementptr inbounds ([1 x i8], [1 x i8]* @str.7, i32 0, i32 0), i64 1 }], align 8
define internal void @_ZN13drop_contents17h3ebc5f399eff4925E(%VerboseDrop*) unnamed_addr {
entry-block:
%1 = getelementptr inbounds %VerboseDrop, %VerboseDrop* %0, i32 0, i32 0
ret void
}
; Function Attrs: uwtable
define internal void @_ZN4core3fmt10ArgumentV13new17h13504c1c43fa6b47E(%"core::fmt::ArgumentV1"* noalias nocapture sret dereferenceable(16), i64* noalias readonly dereferenceable(8), i8 (i64*, %"core::fmt::Formatter"*)*) unnamed_addr #0 {
entry-block:
%lvalue_temp = alloca i8 (%"core::fmt::Void"*, %"core::fmt::Formatter"*)*
%lvalue_temp1 = alloca %"core::fmt::Void"*
br label %start
start: ; preds = %entry-block
%3 = bitcast i8 (%"core::fmt::Void"*, %"core::fmt::Formatter"*)** %lvalue_temp to i8 (i64*, %"core::fmt::Formatter"*)**
store i8 (i64*, %"core::fmt::Formatter"*)* %2, i8 (i64*, %"core::fmt::Formatter"*)** %3
%4 = load i8 (%"core::fmt::Void"*, %"core::fmt::Formatter"*)*, i8 (%"core::fmt::Void"*, %"core::fmt::Formatter"*)** %lvalue_temp
br label %bb1
bb1: ; preds = %start
%5 = bitcast %"core::fmt::Void"** %lvalue_temp1 to i64**
store i64* %1, i64** %5
%6 = load %"core::fmt::Void"*, %"core::fmt::Void"** %lvalue_temp1, !nonnull !1
br label %bb2
bb2: ; preds = %bb1
%7 = getelementptr inbounds %"core::fmt::ArgumentV1", %"core::fmt::ArgumentV1"* %0, i32 0, i32 0
store %"core::fmt::Void"* %6, %"core::fmt::Void"** %7
%8 = getelementptr inbounds %"core::fmt::ArgumentV1", %"core::fmt::ArgumentV1"* %0, i32 0, i32 1
store i8 (%"core::fmt::Void"*, %"core::fmt::Formatter"*)* %4, i8 (%"core::fmt::Void"*, %"core::fmt::Formatter"*)** %8
ret void
}
; Function Attrs: uwtable
define internal void @_ZN4core3fmt10ArgumentV13new17h99b33fc8181d50f4E(%"core::fmt::ArgumentV1"* noalias nocapture sret dereferenceable(16), i32* noalias readonly dereferenceable(4), i8 (i32*, %"core::fmt::Formatter"*)*) unnamed_addr #0 {
entry-block:
%lvalue_temp = alloca i8 (%"core::fmt::Void"*, %"core::fmt::Formatter"*)*
%lvalue_temp1 = alloca %"core::fmt::Void"*
br label %start
start: ; preds = %entry-block
%3 = bitcast i8 (%"core::fmt::Void"*, %"core::fmt::Formatter"*)** %lvalue_temp to i8 (i32*, %"core::fmt::Formatter"*)**
store i8 (i32*, %"core::fmt::Formatter"*)* %2, i8 (i32*, %"core::fmt::Formatter"*)** %3
%4 = load i8 (%"core::fmt::Void"*, %"core::fmt::Formatter"*)*, i8 (%"core::fmt::Void"*, %"core::fmt::Formatter"*)** %lvalue_temp
br label %bb1
bb1: ; preds = %start
%5 = bitcast %"core::fmt::Void"** %lvalue_temp1 to i32**
store i32* %1, i32** %5
%6 = load %"core::fmt::Void"*, %"core::fmt::Void"** %lvalue_temp1, !nonnull !1
br label %bb2
bb2: ; preds = %bb1
%7 = getelementptr inbounds %"core::fmt::ArgumentV1", %"core::fmt::ArgumentV1"* %0, i32 0, i32 0
store %"core::fmt::Void"* %6, %"core::fmt::Void"** %7
%8 = getelementptr inbounds %"core::fmt::ArgumentV1", %"core::fmt::ArgumentV1"* %0, i32 0, i32 1
store i8 (%"core::fmt::Void"*, %"core::fmt::Formatter"*)* %4, i8 (%"core::fmt::Void"*, %"core::fmt::Formatter"*)** %8
ret void
}
; Function Attrs: inlinehint uwtable
define internal void @_ZN4core3fmt9Arguments6new_v117h6f0ed12b1bd40012E(%"core::fmt::Arguments"* noalias nocapture sret dereferenceable(48), %str_slice* noalias nonnull readonly, i64, %"core::fmt::ArgumentV1"* noalias nonnull readonly, i64) unnamed_addr #1 {
entry-block:
%_6 = alloca %"core::option::Option<&[core::fmt::rt::v1::Argument]>"
br label %start
start: ; preds = %entry-block
%5 = getelementptr inbounds %"core::option::Option<&[core::fmt::rt::v1::Argument]>", %"core::option::Option<&[core::fmt::rt::v1::Argument]>"* %_6, i32 0, i32 0, i32 0
store %"core::fmt::rt::v1::Argument"* null, %"core::fmt::rt::v1::Argument"** %5
%6 = getelementptr inbounds %"core::fmt::Arguments", %"core::fmt::Arguments"* %0, i32 0, i32 0
%7 = getelementptr inbounds { %str_slice*, i64 }, { %str_slice*, i64 }* %6, i32 0, i32 0
store %str_slice* %1, %str_slice** %7
%8 = getelementptr inbounds { %str_slice*, i64 }, { %str_slice*, i64 }* %6, i32 0, i32 1
store i64 %2, i64* %8
%9 = getelementptr inbounds %"core::fmt::Arguments", %"core::fmt::Arguments"* %0, i32 0, i32 1
%10 = bitcast %"core::option::Option<&[core::fmt::rt::v1::Argument]>"* %_6 to i8*
%11 = bitcast %"core::option::Option<&[core::fmt::rt::v1::Argument]>"* %9 to i8*
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %11, i8* %10, i64 16, i32 8, i1 false)
%12 = getelementptr inbounds %"core::fmt::Arguments", %"core::fmt::Arguments"* %0, i32 0, i32 2
%13 = getelementptr inbounds { %"core::fmt::ArgumentV1"*, i64 }, { %"core::fmt::ArgumentV1"*, i64 }* %12, i32 0, i32 0
store %"core::fmt::ArgumentV1"* %3, %"core::fmt::ArgumentV1"** %13
%14 = getelementptr inbounds { %"core::fmt::ArgumentV1"*, i64 }, { %"core::fmt::ArgumentV1"*, i64 }* %12, i32 0, i32 1
store i64 %4, i64* %14
ret void
}
define internal void @_ZN4drop17h3ebc5f399eff4925E(%VerboseDrop*) unnamed_addr personality i32 (i32, i32, i64, %"unwind::libunwind::_Unwind_Exception"*, %"unwind::libunwind::_Unwind_Context"*)* @rust_eh_personality {
entry-block:
%1 = alloca { i8*, i32 }
invoke void @"_ZN55_$LT$become..VerboseDrop$u20$as$u20$core..ops..Drop$GT$4drop17he42108df3c2790fbE"(%VerboseDrop* %0)
to label %normal-return unwind label %unwind_custom_
normal-return: ; preds = %entry-block
call void @_ZN13drop_contents17h3ebc5f399eff4925E(%VerboseDrop* %0)
ret void
unwind_custom_: ; preds = %entry-block
%2 = landingpad { i8*, i32 }
cleanup
store { i8*, i32 } %2, { i8*, i32 }* %1
br label %clean_custom_
resume: ; preds = %clean_custom_
%3 = load { i8*, i32 }, { i8*, i32 }* %1
resume { i8*, i32 } %3
clean_custom_: ; preds = %unwind_custom_
call void @_ZN13drop_contents17h3ebc5f399eff4925E(%VerboseDrop* %0)
br label %resume
}
define internal void @_ZN4drop17hba5c5584abe0dc39E(i8*) unnamed_addr {
entry-block:
ret void
}
; Function Attrs: uwtable
define internal void @_ZN4test9black_box17h14d8e65fa9362f88E() unnamed_addr #0 {
entry-block:
%dummy = alloca {}
%_3 = alloca {}
br label %start
start: ; preds = %entry-block
call void asm "", "r,~{dirflag},~{fpsr},~{flags}"({}* %dummy), !srcloc !2
ret void
}
; Function Attrs: uwtable
define internal void @"_ZN55_$LT$become..VerboseDrop$u20$as$u20$core..ops..Drop$GT$4drop17he42108df3c2790fbE"(%VerboseDrop*) unnamed_addr #0 {
entry-block:
%_0 = alloca {}
%_4 = alloca {}
br label %start
start: ; preds = %entry-block
call void @_ZN4test9black_box17h14d8e65fa9362f88E()
br label %bb1
bb1: ; preds = %start
ret void
}
; Function Attrs: noinline uwtable
define internal i64 @_ZN6become13recursive_sum17hc966fe1f086be7e0E(i64, i64) unnamed_addr #2 personality i32 (i32, i32, i64, %"unwind::libunwind::_Unwind_Exception"*, %"unwind::libunwind::_Unwind_Context"*)* @rust_eh_personality {
entry-block:
%_0 = alloca i64
%_5 = alloca {}
%q = alloca %VerboseDrop
%_10 = alloca {}
%personalityslot = alloca { i8*, i32 }
br label %start
start: ; preds = %entry-block
%2 = icmp eq i64 %0, 0
br i1 %2, label %bb1, label %bb2
bb1: ; preds = %start
store i64 %1, i64* %_0
br label %bb3
bb2: ; preds = %start
%3 = call { i64, i1 } @llvm.usub.with.overflow.i64(i64 %0, i64 1)
%4 = extractvalue { i64, i1 } %3, 0
%5 = extractvalue { i64, i1 } %3, 1
%6 = call i1 @llvm.expect.i1(i1 %5, i1 false)
br i1 %6, label %panic, label %bb6
bb3: ; preds = %bb1, %bb8
%7 = load i64, i64* %_0
ret i64 %7
bb4: ; preds = %cleanup2, %bb5
%8 = load { i8*, i32 }, { i8*, i32 }* %personalityslot
resume { i8*, i32 } %8
bb5: ; preds = %cleanup
call void @_ZN4drop17h3ebc5f399eff4925E(%VerboseDrop* %q)
br label %bb4
bb6: ; preds = %bb2
%9 = call { i64, i1 } @llvm.uadd.with.overflow.i64(i64 %1, i64 %0)
%10 = extractvalue { i64, i1 } %9, 0
%11 = extractvalue { i64, i1 } %9, 1
%12 = call i1 @llvm.expect.i1(i1 %11, i1 false)
br i1 %12, label %panic1, label %bb7
bb7: ; preds = %bb6
invoke void @_ZN4drop17h3ebc5f399eff4925E(%VerboseDrop* %q)
to label %bb8 unwind label %cleanup2
bb8: ; preds = %bb7
%13 = tail call i64 @_ZN6become13recursive_sum17hc966fe1f086be7e0E(i64 %4, i64 %10)
store i64 %13, i64* %_0
br label %bb3
panic: ; preds = %bb2
invoke void @_ZN4core9panicking5panic17he13c0c596e5bd23cE({ %str_slice, %str_slice, i32 }* @panic_loc.2)
to label %unreachable unwind label %cleanup
unreachable: ; preds = %panic1, %panic
unreachable
cleanup: ; preds = %panic1, %panic
%14 = landingpad { i8*, i32 }
cleanup
store { i8*, i32 } %14, { i8*, i32 }* %personalityslot
br label %bb5
panic1: ; preds = %bb6
invoke void @_ZN4core9panicking5panic17he13c0c596e5bd23cE({ %str_slice, %str_slice, i32 }* @panic_loc.4)
to label %unreachable unwind label %cleanup
cleanup2: ; preds = %bb7
%15 = landingpad { i8*, i32 }
cleanup
store { i8*, i32 } %15, { i8*, i32 }* %personalityslot
br label %bb4
}
; Function Attrs: uwtable
define internal void @_ZN6become4main17h3f4173f5532f1a43E() unnamed_addr #0 {
entry-block:
%_2 = alloca %"core::fmt::Arguments"
%_7 = alloca [1 x %"core::fmt::ArgumentV1"]
%_8 = alloca { i32* }
%_14 = alloca %"core::fmt::Arguments"
%_19 = alloca [1 x %"core::fmt::ArgumentV1"]
%_20 = alloca { i64* }
%_22 = alloca i64
%tmp_ret = alloca %"core::fmt::ArgumentV1"
%tmp_ret1 = alloca %"core::fmt::ArgumentV1"
br label %start
start: ; preds = %entry-block
%0 = load %str_slice*, %str_slice** getelementptr inbounds ({ %str_slice*, i64 }, { %str_slice*, i64 }* @_ZN6become4main15__STATIC_FMTSTR17h029dfc57aaf27f81E, i32 0, i32 0), !nonnull !1
%1 = load i64, i64* getelementptr inbounds ({ %str_slice*, i64 }, { %str_slice*, i64 }* @_ZN6become4main15__STATIC_FMTSTR17h029dfc57aaf27f81E, i32 0, i32 1)
%2 = getelementptr inbounds { i32* }, { i32* }* %_8, i32 0, i32 0
store i32* @ref.5, i32** %2
%3 = getelementptr inbounds { i32* }, { i32* }* %_8, i32 0, i32 0
%4 = load i32*, i32** %3, !nonnull !1
call void @_ZN4core3fmt10ArgumentV13new17h99b33fc8181d50f4E(%"core::fmt::ArgumentV1"* noalias nocapture sret dereferenceable(16) %tmp_ret, i32* noalias readonly dereferenceable(4) %4, i8 (i32*, %"core::fmt::Formatter"*)* @"_ZN4core3fmt3num52_$LT$impl$u20$core..fmt..Display$u20$for$u20$i32$GT$3fmt17h464b0ee5bc5b0718E")
%5 = getelementptr inbounds %"core::fmt::ArgumentV1", %"core::fmt::ArgumentV1"* %tmp_ret, i32 0, i32 0
%6 = getelementptr inbounds %"core::fmt::ArgumentV1", %"core::fmt::ArgumentV1"* %tmp_ret, i32 0, i32 1
%7 = load %"core::fmt::Void"*, %"core::fmt::Void"** %5, !nonnull !1
%8 = load i8 (%"core::fmt::Void"*, %"core::fmt::Formatter"*)*, i8 (%"core::fmt::Void"*, %"core::fmt::Formatter"*)** %6
br label %bb1
bb1: ; preds = %start
%9 = getelementptr inbounds [1 x %"core::fmt::ArgumentV1"], [1 x %"core::fmt::ArgumentV1"]* %_7, i32 0, i32 0
%10 = getelementptr inbounds %"core::fmt::ArgumentV1", %"core::fmt::ArgumentV1"* %9, i32 0, i32 0
store %"core::fmt::Void"* %7, %"core::fmt::Void"** %10
%11 = getelementptr inbounds %"core::fmt::ArgumentV1", %"core::fmt::ArgumentV1"* %9, i32 0, i32 1
store i8 (%"core::fmt::Void"*, %"core::fmt::Formatter"*)* %8, i8 (%"core::fmt::Void"*, %"core::fmt::Formatter"*)** %11
%12 = bitcast [1 x %"core::fmt::ArgumentV1"]* %_7 to %"core::fmt::ArgumentV1"*
call void @_ZN4core3fmt9Arguments6new_v117h6f0ed12b1bd40012E(%"core::fmt::Arguments"* noalias nocapture sret dereferenceable(48) %_2, %str_slice* noalias nonnull readonly %0, i64 %1, %"core::fmt::ArgumentV1"* noalias nonnull readonly %12, i64 1)
br label %bb2
bb2: ; preds = %bb1
call void @_ZN3std2io5stdio6_print17h0c52b4384e942cc5E(%"core::fmt::Arguments"* noalias nocapture dereferenceable(48) %_2)
br label %bb3
bb3: ; preds = %bb2
%13 = load %str_slice*, %str_slice** getelementptr inbounds ({ %str_slice*, i64 }, { %str_slice*, i64 }* @_ZN6become4main15__STATIC_FMTSTR17h3639e0ebacaa7deaE, i32 0, i32 0), !nonnull !1
%14 = load i64, i64* getelementptr inbounds ({ %str_slice*, i64 }, { %str_slice*, i64 }* @_ZN6become4main15__STATIC_FMTSTR17h3639e0ebacaa7deaE, i32 0, i32 1)
%15 = call i64 @_ZN6become13recursive_sum17hc966fe1f086be7e0E(i64 10000000, i64 0)
store i64 %15, i64* %_22
br label %bb4
bb4: ; preds = %bb3
%16 = getelementptr inbounds { i64* }, { i64* }* %_20, i32 0, i32 0
store i64* %_22, i64** %16
%17 = getelementptr inbounds { i64* }, { i64* }* %_20, i32 0, i32 0
%18 = load i64*, i64** %17, !nonnull !1
call void @_ZN4core3fmt10ArgumentV13new17h13504c1c43fa6b47E(%"core::fmt::ArgumentV1"* noalias nocapture sret dereferenceable(16) %tmp_ret1, i64* noalias readonly dereferenceable(8) %18, i8 (i64*, %"core::fmt::Formatter"*)* @"_ZN4core3fmt3num52_$LT$impl$u20$core..fmt..Display$u20$for$u20$u64$GT$3fmt17h82d0adc5d55cd9dfE")
%19 = getelementptr inbounds %"core::fmt::ArgumentV1", %"core::fmt::ArgumentV1"* %tmp_ret1, i32 0, i32 0
%20 = getelementptr inbounds %"core::fmt::ArgumentV1", %"core::fmt::ArgumentV1"* %tmp_ret1, i32 0, i32 1
%21 = load %"core::fmt::Void"*, %"core::fmt::Void"** %19, !nonnull !1
%22 = load i8 (%"core::fmt::Void"*, %"core::fmt::Formatter"*)*, i8 (%"core::fmt::Void"*, %"core::fmt::Formatter"*)** %20
br label %bb5
bb5: ; preds = %bb4
%23 = getelementptr inbounds [1 x %"core::fmt::ArgumentV1"], [1 x %"core::fmt::ArgumentV1"]* %_19, i32 0, i32 0
%24 = getelementptr inbounds %"core::fmt::ArgumentV1", %"core::fmt::ArgumentV1"* %23, i32 0, i32 0
store %"core::fmt::Void"* %21, %"core::fmt::Void"** %24
%25 = getelementptr inbounds %"core::fmt::ArgumentV1", %"core::fmt::ArgumentV1"* %23, i32 0, i32 1
store i8 (%"core::fmt::Void"*, %"core::fmt::Formatter"*)* %22, i8 (%"core::fmt::Void"*, %"core::fmt::Formatter"*)** %25
%26 = bitcast [1 x %"core::fmt::ArgumentV1"]* %_19 to %"core::fmt::ArgumentV1"*
call void @_ZN4core3fmt9Arguments6new_v117h6f0ed12b1bd40012E(%"core::fmt::Arguments"* noalias nocapture sret dereferenceable(48) %_14, %str_slice* noalias nonnull readonly %13, i64 %14, %"core::fmt::ArgumentV1"* noalias nonnull readonly %26, i64 1)
br label %bb6
bb6: ; preds = %bb5
call void @_ZN3std2io5stdio6_print17h0c52b4384e942cc5E(%"core::fmt::Arguments"* noalias nocapture dereferenceable(48) %_14)
br label %bb7
bb7: ; preds = %bb6
ret void
}
; Function Attrs: argmemonly nounwind
declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture writeonly, i8* nocapture readonly, i64, i32, i1) #3
; Function Attrs: nounwind
declare i32 @rust_eh_personality(i32, i32, i64, %"unwind::libunwind::_Unwind_Exception"*, %"unwind::libunwind::_Unwind_Context"*) unnamed_addr #4
; Function Attrs: nounwind readnone
declare { i64, i1 } @llvm.usub.with.overflow.i64(i64, i64) #5
; Function Attrs: nounwind readnone
declare i1 @llvm.expect.i1(i1, i1) #5
; Function Attrs: cold noinline noreturn
declare void @_ZN4core9panicking5panic17he13c0c596e5bd23cE({ %str_slice, %str_slice, i32 }* noalias readonly dereferenceable(40)) unnamed_addr #6
; Function Attrs: nounwind readnone
declare { i64, i1 } @llvm.uadd.with.overflow.i64(i64, i64) #5
declare i8 @"_ZN4core3fmt3num52_$LT$impl$u20$core..fmt..Display$u20$for$u20$i32$GT$3fmt17h464b0ee5bc5b0718E"(i32* noalias readonly dereferenceable(4), %"core::fmt::Formatter"* dereferenceable(96)) unnamed_addr
declare void @_ZN3std2io5stdio6_print17h0c52b4384e942cc5E(%"core::fmt::Arguments"* noalias nocapture dereferenceable(48)) unnamed_addr
declare i8 @"_ZN4core3fmt3num52_$LT$impl$u20$core..fmt..Display$u20$for$u20$u64$GT$3fmt17h82d0adc5d55cd9dfE"(i64* noalias readonly dereferenceable(8), %"core::fmt::Formatter"* dereferenceable(96)) unnamed_addr
define i64 @main(i64, i8**) unnamed_addr {
top:
%2 = call i64 @_ZN3std2rt10lang_start17h8d51a6012f37187dE(i8* bitcast (void ()* @_ZN6become4main17h3f4173f5532f1a43E to i8*), i64 %0, i8** %1)
ret i64 %2
}
declare i64 @_ZN3std2rt10lang_start17h8d51a6012f37187dE(i8*, i64, i8**) unnamed_addr
attributes #0 = { uwtable }
attributes #1 = { inlinehint uwtable }
attributes #2 = { noinline uwtable }
attributes #3 = { argmemonly nounwind }
attributes #4 = { nounwind }
attributes #5 = { nounwind readnone }
attributes #6 = { cold noinline noreturn }
!llvm.module.flags = !{!0}
!0 = !{i32 1, !"PIE Level", i32 2}
!1 = !{}
!2 = !{i32 211}
// MIR for `recursive_sum`
// node_id = 25
// pass_name = PreTrans
// disambiguator = after
fn recursive_sum(_1: u64, _2: u64) -> u64 {
let mut _0: u64; // return pointer
scope 1 {
let _3: u64; // "x" in scope 1 at become.rs:13:18: 13:19
let _4: u64; // "y" in scope 1 at become.rs:13:26: 13:27
scope 2 {
let _9: VerboseDrop; // "q" in scope 2 at become.rs:18:9: 18:10
}
}
let mut _5: ();
let mut _6: bool;
let mut _7: u64;
let mut _8: u64;
let mut _10: ();
let mut _11: u64;
let mut _12: u64;
let mut _13: u64;
let mut _14: u64;
let mut _15: u64;
bb0: {
StorageLive(_3); // scope 0 at become.rs:13:18: 13:19
_3 = _1; // scope 0 at become.rs:13:18: 13:19
StorageLive(_4); // scope 0 at become.rs:13:26: 13:27
_4 = _2; // scope 0 at become.rs:13:26: 13:27
StorageLive(_6); // scope 1 at become.rs:14:8: 14:14
StorageLive(_7); // scope 1 at become.rs:14:8: 14:9
_7 = _3; // scope 1 at become.rs:14:8: 14:9
_6 = Eq(_7, const 0u64); // scope 1 at become.rs:14:8: 14:14
StorageDead(_6); // scope 1 at become.rs:14:14: 14:14
StorageDead(_7); // scope 1 at become.rs:14:14: 14:14
if(_6) -> [true: bb1, false: bb2]; // scope 1 at become.rs:14:5: 17:6
}
bb1: {
StorageLive(_8); // scope 1 at become.rs:16:16: 16:17
_8 = _4; // scope 1 at become.rs:16:16: 16:17
_0 = _8; // scope 1 at become.rs:16:16: 16:17
StorageDead(_8); // scope 1 at become.rs:17:6: 17:6
StorageDead(_4); // scope 0 at become.rs:21:2: 21:2
StorageDead(_3); // scope 0 at become.rs:21:2: 21:2
goto -> bb3; // scope 0 at become.rs:16:9: 16:17
}
bb2: {
_5 = (); // scope 1 at become.rs:14:5: 17:6
StorageLive(_9); // scope 1 at become.rs:18:9: 18:10
StorageLive(_10); // scope 1 at become.rs:18:25: 18:27
_10 = (); // scope 1 at become.rs:18:25: 18:27
_9 = VerboseDrop::{{constructor}}(_10,); // scope 1 at become.rs:18:13: 18:28
StorageDead(_10); // scope 1 at become.rs:18:29: 18:29
StorageLive(_12); // scope 2 at become.rs:20:26: 20:27
_12 = _3; // scope 2 at become.rs:20:26: 20:27
_11 = Sub(_12, const 1u64); // scope 2 at become.rs:20:5: 20:39
StorageLive(_14); // scope 2 at become.rs:20:33: 20:34
_14 = _4; // scope 2 at become.rs:20:33: 20:34
StorageLive(_15); // scope 2 at become.rs:20:37: 20:38
_15 = _3; // scope 2 at become.rs:20:37: 20:38
_13 = Add(_14, _15); // scope 2 at become.rs:20:5: 20:39
drop(_9) -> [return: bb4, unwind: bb5]; // scope 1 at become.rs:21:2: 21:2
}
bb3: {
return; // scope 1 at become.rs:21:2: 21:2
}
bb4: {
StorageDead(_9); // scope 1 at become.rs:21:2: 21:2
StorageDead(_15); // scope 1 at become.rs:21:2: 21:2
StorageDead(_14); // scope 1 at become.rs:21:2: 21:2
StorageDead(_12); // scope 1 at become.rs:21:2: 21:2
StorageDead(_4); // scope 0 at become.rs:21:2: 21:2
StorageDead(_3); // scope 0 at become.rs:21:2: 21:2
_0 = recursive_sum(_11, _13) -> bb3; // scope 2 at become.rs:20:5: 20:39
}
bb5: {
resume; // scope 0 at become.rs:13:1: 21:2
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment