Skip to content

Instantly share code, notes, and snippets.

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 alexcrichton/715515a1967ccc0bc1d47e285aa372e3 to your computer and use it in GitHub Desktop.
Save alexcrichton/715515a1967ccc0bc1d47e285aa372e3 to your computer and use it in GitHub Desktop.
; ModuleID = 'panic_macro_fmt0-317d481089b8c8fe83113de504472633.rs'
source_filename = "panic_macro_fmt0-317d481089b8c8fe83113de504472633.rs"
target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
target triple = "arm-unknown-linux-gnueabihf"
%"core::ops::function::Fn<(), Output=i32>" = type {}
%"core::fmt::Formatter" = type { [0 x i32], i32, [0 x i32], i32, [0 x i32], %"core::option::Option<usize>", [0 x i32], %"core::option::Option<usize>", [0 x i32], { %"core::fmt::Write"*, {}* }, [0 x i32], { i32*, i32* }, [0 x i32], { [0 x { i8*, i8* }]*, i32 }, [0 x i8], i8, [3 x i8] }
%"core::option::Option<usize>" = type { [0 x i32], i32, [1 x i32] }
%"core::fmt::Write" = type {}
%"core::fmt::Arguments" = type { [0 x i32], { [0 x { [0 x i8]*, i32 }]*, i32 }, [0 x i32], %"core::option::Option<&[core::fmt::rt::v1::Argument]>", [0 x i32], { [0 x { i8*, i8* }]*, i32 }, [0 x i32] }
%"core::option::Option<&[core::fmt::rt::v1::Argument]>" = type { [0 x i32], {}*, [1 x i32] }
%"core::fmt::rt::v1::Argument" = type { [0 x i32], %"core::fmt::rt::v1::Position", [0 x i32], %"core::fmt::rt::v1::FormatSpec", [0 x i32] }
%"core::fmt::rt::v1::Position" = type { [0 x i32], i32, [1 x i32] }
%"core::fmt::rt::v1::FormatSpec" = type { [0 x i32], i32, [0 x i32], i32, [0 x i32], %"core::fmt::rt::v1::Count", [0 x i32], %"core::fmt::rt::v1::Count", [0 x i8], i8, [3 x i8] }
%"core::fmt::rt::v1::Count" = type { [0 x i32], i32, [1 x i32] }
%"unwind::libunwind::_Unwind_Exception" = type { [0 x i64], i64, [0 x i32], void (i32, %"unwind::libunwind::_Unwind_Exception"*)*, [0 x i32], [20 x i32], [1 x i32] }
%"unwind::libunwind::_Unwind_Context" = type { [0 x i8] }
@vtable.0 = private unnamed_addr constant { void (i8**)*, i32, i32, i32 (i8**)*, i32 (i8**)*, i32 (i8*)* } { void (i8**)* @_ZN4core3ptr13drop_in_place17h9fcfc3288b308a40E, i32 4, i32 4, i32 (i8**)* @"_ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17h8d2388017df036f2E", i32 (i8**)* @"_ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17h8d2388017df036f2E", i32 (i8*)* @_ZN4core3ops8function6FnOnce9call_once17h0107fd4c19a0a4e1E }, align 4
@str.1 = internal constant [0 x i8] zeroinitializer
@str.2 = internal constant [1 x i8] c" "
@ref.3 = private unnamed_addr constant [2 x { [0 x i8]*, i32 }] [{ [0 x i8]*, i32 } { [0 x i8]* @str.1, i32 0 }, { [0 x i8]*, i32 } { [0 x i8]* bitcast ([1 x i8]* @str.2 to [0 x i8]*), i32 1 }], align 4
@ref.4 = private unnamed_addr constant i32 0, align 4
@ref.5 = private unnamed_addr constant { [0 x i8]*, i32 } { [0 x i8]* @str.1, i32 0 }, align 4
@ref.6 = private unnamed_addr constant { { [0 x i8], { i32, [0 x i8], i32, [0 x i8] }, [0 x i8], { [0 x i8], i32, [0 x i8], i32, [0 x i8], <{ i32, [4 x i8] }>, [0 x i8], <{ i32, [4 x i8] }>, [0 x i8], i8, [3 x i8] }, [0 x i8] }, { [0 x i8], { i32, [0 x i8], i32, [0 x i8] }, [0 x i8], { [0 x i8], i32, [0 x i8], i32, [0 x i8], <{ i32, [4 x i8] }>, [0 x i8], <{ i32, [4 x i8] }>, [0 x i8], i8, [3 x i8] }, [0 x i8] } } { { [0 x i8], { i32, [0 x i8], i32, [0 x i8] }, [0 x i8], { [0 x i8], i32, [0 x i8], i32, [0 x i8], <{ i32, [4 x i8] }>, [0 x i8], <{ i32, [4 x i8] }>, [0 x i8], i8, [3 x i8] }, [0 x i8] } { [0 x i8] undef, { i32, [0 x i8], i32, [0 x i8] } { i32 1, [0 x i8] undef, i32 0, [0 x i8] undef }, [0 x i8] undef, { [0 x i8], i32, [0 x i8], i32, [0 x i8], <{ i32, [4 x i8] }>, [0 x i8], <{ i32, [4 x i8] }>, [0 x i8], i8, [3 x i8] } { [0 x i8] undef, i32 32, [0 x i8] undef, i32 0, [0 x i8] undef, <{ i32, [4 x i8] }> <{ i32 3, [4 x i8] undef }>, [0 x i8] undef, <{ i32, [4 x i8] }> <{ i32 3, [4 x i8] undef }>, [0 x i8] undef, i8 3, [3 x i8] undef }, [0 x i8] undef }, { [0 x i8], { i32, [0 x i8], i32, [0 x i8] }, [0 x i8], { [0 x i8], i32, [0 x i8], i32, [0 x i8], <{ i32, [4 x i8] }>, [0 x i8], <{ i32, [4 x i8] }>, [0 x i8], i8, [3 x i8] }, [0 x i8] } { [0 x i8] undef, { i32, [0 x i8], i32, [0 x i8] } { i32 1, [0 x i8] undef, i32 1, [0 x i8] undef }, [0 x i8] undef, { [0 x i8], i32, [0 x i8], i32, [0 x i8], <{ i32, [4 x i8] }>, [0 x i8], <{ i32, [4 x i8] }>, [0 x i8], i8, [3 x i8] } { [0 x i8] undef, i32 32, [0 x i8] undef, i32 0, [0 x i8] undef, <{ i32, [4 x i8] }> <{ i32 3, [4 x i8] undef }>, [0 x i8] undef, <{ i32, [4 x i8] }> <{ i32 3, [4 x i8] undef }>, [0 x i8] undef, i8 3, [3 x i8] undef }, [0 x i8] undef } }, align 4
@str.8 = internal constant [36 x i8] c"src/test/run-fail/panic-macro-fmt.rs"
@ref.9 = private unnamed_addr constant { [0 x i8], { [0 x i8]*, i32 }, [0 x i8], i32, [0 x i8], i32, [0 x i8] } { [0 x i8] undef, { [0 x i8]*, i32 } { [0 x i8]* bitcast ([36 x i8]* @str.8 to [0 x i8]*), i32 36 }, [0 x i8] undef, i32 14, [0 x i8] undef, i32 5, [0 x i8] undef }, align 4
; std::rt::lang_start
; Function Attrs: uwtable
define hidden i32 @_ZN3std2rt10lang_start17hed6fef385d80935dE(void ()* nonnull %main, i32 %argc, i8** %argv) unnamed_addr #0 {
start:
%_7 = alloca i8*, align 4
%0 = bitcast i8** %_7 to i8*
call void @llvm.lifetime.start.p0i8(i64 4, i8* nonnull %0)
%1 = bitcast i8** %_7 to void ()**
store void ()* %main, void ()** %1, align 4
%2 = bitcast i8** %_7 to %"core::ops::function::Fn<(), Output=i32>"*
; call std::rt::lang_start_internal
%3 = call i32 @_ZN3std2rt19lang_start_internal17h0e5215cb9f3c1f91E(%"core::ops::function::Fn<(), Output=i32>"* nonnull %2, {}* noalias nonnull readonly bitcast ({ void (i8**)*, i32, i32, i32 (i8**)*, i32 (i8**)*, i32 (i8*)* }* @vtable.0 to {}*), i32 %argc, i8** %argv)
call void @llvm.lifetime.end.p0i8(i64 4, i8* nonnull %0)
ret i32 %3
}
; std::rt::lang_start::{{closure}}
; Function Attrs: uwtable
define internal i32 @"_ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17h8d2388017df036f2E"(i8** noalias nocapture readonly dereferenceable(4) %arg0) unnamed_addr #0 {
start:
%0 = bitcast i8** %arg0 to void ()**
%1 = load void ()*, void ()** %0, align 4
tail call void %1()
; call <() as std::termination::Termination>::report
%2 = tail call i32 @"_ZN58_$LT$$LP$$RP$$u20$as$u20$std..termination..Termination$GT$6report17hc1073ff0b2ae3977E"()
ret i32 %2
}
; core::ops::function::FnOnce::call_once
; Function Attrs: uwtable
define internal i32 @_ZN4core3ops8function6FnOnce9call_once17h0107fd4c19a0a4e1E(i8* nonnull) unnamed_addr #0 personality i32 (i32, %"unwind::libunwind::_Unwind_Exception"*, %"unwind::libunwind::_Unwind_Context"*)* @rust_eh_personality {
start:
%1 = bitcast i8* %0 to void ()*
tail call void %1()
; call <() as std::termination::Termination>::report
%2 = tail call i32 @"_ZN58_$LT$$LP$$RP$$u20$as$u20$std..termination..Termination$GT$6report17hc1073ff0b2ae3977E"()
ret i32 %2
}
; core::ptr::drop_in_place
; Function Attrs: norecurse nounwind readnone uwtable
define internal void @_ZN4core3ptr13drop_in_place17h9fcfc3288b308a40E(i8** nocapture %arg0) unnamed_addr #1 {
start:
ret void
}
; <&'a T as core::fmt::Display>::fmt
; Function Attrs: uwtable
define internal zeroext i1 @"_ZN55_$LT$$RF$$u27$a$u20$T$u20$as$u20$core..fmt..Display$GT$3fmt17h640136b71e79ec71E"({ [0 x i8]*, i32 }* noalias nocapture readonly dereferenceable(8) %self, %"core::fmt::Formatter"* dereferenceable(52) %f) unnamed_addr #0 {
start:
%0 = getelementptr inbounds { [0 x i8]*, i32 }, { [0 x i8]*, i32 }* %self, i32 0, i32 0
%1 = load [0 x i8]*, [0 x i8]** %0, align 4
%2 = getelementptr inbounds { [0 x i8]*, i32 }, { [0 x i8]*, i32 }* %self, i32 0, i32 1
%3 = load i32, i32* %2, align 4
; call <str as core::fmt::Display>::fmt
%4 = tail call zeroext i1 @"_ZN42_$LT$str$u20$as$u20$core..fmt..Display$GT$3fmt17hacdc7c5a97110995E"([0 x i8]* noalias nonnull readonly %1, i32 %3, %"core::fmt::Formatter"* nonnull dereferenceable(52) %f)
ret i1 %4
}
; panic_macro_fmt::main
; Function Attrs: noreturn uwtable
define internal void @_ZN15panic_macro_fmt4main17h99361a32497e6ebaE() unnamed_addr #2 {
start:
%_10 = alloca [2 x { i8*, i8* }], align 4
%_3 = alloca %"core::fmt::Arguments", align 4
%0 = bitcast %"core::fmt::Arguments"* %_3 to i8*
call void @llvm.lifetime.start.p0i8(i64 24, i8* nonnull %0)
%1 = bitcast [2 x { i8*, i8* }]* %_10 to i8*
call void @llvm.lifetime.start.p0i8(i64 16, i8* nonnull %1)
%2 = getelementptr inbounds [2 x { i8*, i8* }], [2 x { i8*, i8* }]* %_10, i32 0, i32 0, i32 0
store i8* bitcast (i32* @ref.4 to i8*), i8** %2, align 4
%3 = getelementptr inbounds [2 x { i8*, i8* }], [2 x { i8*, i8* }]* %_10, i32 0, i32 0, i32 1
store i8* bitcast (i1 (i32*, %"core::fmt::Formatter"*)* @"_ZN4core3fmt3num52_$LT$impl$u20$core..fmt..Display$u20$for$u20$i32$GT$3fmt17h7e68245a38d20917E" to i8*), i8** %3, align 4
%4 = getelementptr inbounds [2 x { i8*, i8* }], [2 x { i8*, i8* }]* %_10, i32 0, i32 1, i32 0
store i8* bitcast ({ [0 x i8]*, i32 }* @ref.5 to i8*), i8** %4, align 4
%5 = getelementptr inbounds [2 x { i8*, i8* }], [2 x { i8*, i8* }]* %_10, i32 0, i32 1, i32 1
store i8* bitcast (i1 ({ [0 x i8]*, i32 }*, %"core::fmt::Formatter"*)* @"_ZN55_$LT$$RF$$u27$a$u20$T$u20$as$u20$core..fmt..Display$GT$3fmt17h640136b71e79ec71E" to i8*), i8** %5, align 4
%6 = bitcast %"core::fmt::Arguments"* %_3 to [0 x { [0 x i8]*, i32 }]**
store [0 x { [0 x i8]*, i32 }]* bitcast ([2 x { [0 x i8]*, i32 }]* @ref.3 to [0 x { [0 x i8]*, i32 }]*), [0 x { [0 x i8]*, i32 }]** %6, align 4
%7 = getelementptr inbounds %"core::fmt::Arguments", %"core::fmt::Arguments"* %_3, i32 0, i32 1, i32 1
store i32 2, i32* %7, align 4
%_5.sroa.0.0..sroa_idx.i = getelementptr inbounds %"core::fmt::Arguments", %"core::fmt::Arguments"* %_3, i32 0, i32 3
%_5.sroa.0.0..sroa_cast1.i = bitcast %"core::option::Option<&[core::fmt::rt::v1::Argument]>"* %_5.sroa.0.0..sroa_idx.i to [0 x %"core::fmt::rt::v1::Argument"]**
store [0 x %"core::fmt::rt::v1::Argument"]* bitcast ({ { [0 x i8], { i32, [0 x i8], i32, [0 x i8] }, [0 x i8], { [0 x i8], i32, [0 x i8], i32, [0 x i8], <{ i32, [4 x i8] }>, [0 x i8], <{ i32, [4 x i8] }>, [0 x i8], i8, [3 x i8] }, [0 x i8] }, { [0 x i8], { i32, [0 x i8], i32, [0 x i8] }, [0 x i8], { [0 x i8], i32, [0 x i8], i32, [0 x i8], <{ i32, [4 x i8] }>, [0 x i8], <{ i32, [4 x i8] }>, [0 x i8], i8, [3 x i8] }, [0 x i8] } }* @ref.6 to [0 x %"core::fmt::rt::v1::Argument"]*), [0 x %"core::fmt::rt::v1::Argument"]** %_5.sroa.0.0..sroa_cast1.i, align 4
%_5.sroa.4.0..sroa_idx3.i = getelementptr inbounds %"core::fmt::Arguments", %"core::fmt::Arguments"* %_3, i32 0, i32 3, i32 2, i32 0
store i32 2, i32* %_5.sroa.4.0..sroa_idx3.i, align 4
%8 = getelementptr inbounds %"core::fmt::Arguments", %"core::fmt::Arguments"* %_3, i32 0, i32 5, i32 0
%9 = bitcast [0 x { i8*, i8* }]** %8 to [2 x { i8*, i8* }]**
store [2 x { i8*, i8* }]* %_10, [2 x { i8*, i8* }]** %9, align 4
%10 = getelementptr inbounds %"core::fmt::Arguments", %"core::fmt::Arguments"* %_3, i32 0, i32 5, i32 1
store i32 2, i32* %10, align 4
; call std::panicking::begin_panic_fmt
call void @_ZN3std9panicking15begin_panic_fmt17hfdc03dc8433a2e74E(%"core::fmt::Arguments"* noalias nonnull readonly dereferenceable(24) %_3, { [0 x i32], { [0 x i8]*, i32 }, [0 x i32], i32, [0 x i32], i32, [0 x i32] }* noalias readonly dereferenceable(16) bitcast ({ [0 x i8], { [0 x i8]*, i32 }, [0 x i8], i32, [0 x i8], i32, [0 x i8] }* @ref.9 to { [0 x i32], { [0 x i8]*, i32 }, [0 x i32], i32, [0 x i32], i32, [0 x i32] }*))
unreachable
}
; std::rt::lang_start_internal
declare i32 @_ZN3std2rt19lang_start_internal17h0e5215cb9f3c1f91E(%"core::ops::function::Fn<(), Output=i32>"* nonnull, {}* noalias nonnull readonly, i32, i8**) unnamed_addr
; <() as std::termination::Termination>::report
declare i32 @"_ZN58_$LT$$LP$$RP$$u20$as$u20$std..termination..Termination$GT$6report17hc1073ff0b2ae3977E"() unnamed_addr
declare i32 @rust_eh_personality(i32, %"unwind::libunwind::_Unwind_Exception"*, %"unwind::libunwind::_Unwind_Context"*) unnamed_addr
; <str as core::fmt::Display>::fmt
declare zeroext i1 @"_ZN42_$LT$str$u20$as$u20$core..fmt..Display$GT$3fmt17hacdc7c5a97110995E"([0 x i8]* noalias nonnull readonly, i32, %"core::fmt::Formatter"* dereferenceable(52)) unnamed_addr
; core::fmt::num::<impl core::fmt::Display for i32>::fmt
declare zeroext i1 @"_ZN4core3fmt3num52_$LT$impl$u20$core..fmt..Display$u20$for$u20$i32$GT$3fmt17h7e68245a38d20917E"(i32* noalias readonly dereferenceable(4), %"core::fmt::Formatter"* dereferenceable(52)) unnamed_addr
; std::panicking::begin_panic_fmt
; Function Attrs: cold noinline noreturn
declare void @_ZN3std9panicking15begin_panic_fmt17hfdc03dc8433a2e74E(%"core::fmt::Arguments"* noalias readonly dereferenceable(24), { [0 x i32], { [0 x i8]*, i32 }, [0 x i32], i32, [0 x i32], i32, [0 x i32] }* noalias readonly dereferenceable(16)) unnamed_addr #3
define i32 @main(i32, i8**) unnamed_addr {
top:
%_7.i = alloca i8*, align 4
%2 = bitcast i8** %_7.i to i8*
call void @llvm.lifetime.start.p0i8(i64 4, i8* nonnull %2)
%3 = bitcast i8** %_7.i to void ()**
store void ()* @_ZN15panic_macro_fmt4main17h99361a32497e6ebaE, void ()** %3, align 4
%4 = bitcast i8** %_7.i to %"core::ops::function::Fn<(), Output=i32>"*
; call std::rt::lang_start_internal
%5 = call i32 @_ZN3std2rt19lang_start_internal17h0e5215cb9f3c1f91E(%"core::ops::function::Fn<(), Output=i32>"* nonnull %4, {}* noalias nonnull readonly bitcast ({ void (i8**)*, i32, i32, i32 (i8**)*, i32 (i8**)*, i32 (i8*)* }* @vtable.0 to {}*), i32 %0, i8** %1)
call void @llvm.lifetime.end.p0i8(i64 4, i8* nonnull %2)
ret i32 %5
}
; Function Attrs: argmemonly nounwind
declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) #4
; Function Attrs: argmemonly nounwind
declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) #4
attributes #0 = { uwtable }
attributes #1 = { norecurse nounwind readnone uwtable }
attributes #2 = { noreturn uwtable }
attributes #3 = { cold noinline noreturn }
attributes #4 = { argmemonly nounwind }
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// error-pattern:panicked at 'test-fail-fmt 42 rust'
fn main() {
panic!("{} {}", 0, "");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment