Skip to content

Instantly share code, notes, and snippets.

@TimNN

TimNN/val-opt.ll Secret

Last active March 5, 2017 11:38
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 TimNN/419a598a0c5795dc2a83657ae684539f to your computer and use it in GitHub Desktop.
Save TimNN/419a598a0c5795dc2a83657ae684539f to your computer and use it in GitHub Desktop.
; ModuleID = 'val.ll'
source_filename = "val.cgu-0.rs"
target datalayout = "e-p:32:32-i64:64-v128:32:128-n32-S128"
target triple = "asmjs-unknown-emscripten"
%str_slice = type { i8*, i32 }
@str.0 = internal constant [6 x i8] c"val.rs"
@panic_bounds_check_loc.1 = internal unnamed_addr constant { %str_slice, i32 } { %str_slice { i8* getelementptr inbounds ([6 x i8], [6 x i8]* @str.0, i32 0, i32 0), i32 6 }, i32 13 }, align 4
; Function Attrs: inlinehint norecurse nounwind
define internal fastcc void @_ZN4core3ptr14write_volatile17hbd022764e1ac0bafE([32 x i64]*, [32 x i64]* noalias nocapture readonly dereferenceable(256)) unnamed_addr #0 personality i32 (...)* @rust_eh_personality {
entry-block:
%src.sroa.0.0..sroa_idx = getelementptr inbounds [32 x i64], [32 x i64]* %1, i32 0, i32 0
%src.sroa.0.0.copyload = load i64, i64* %src.sroa.0.0..sroa_idx, align 8
%src.sroa.2.0..sroa_idx32 = getelementptr inbounds [32 x i64], [32 x i64]* %1, i32 0, i32 1
%src.sroa.2.0.copyload = load i64, i64* %src.sroa.2.0..sroa_idx32, align 8
%src.sroa.3.0..sroa_idx33 = getelementptr inbounds [32 x i64], [32 x i64]* %1, i32 0, i32 2
%src.sroa.3.0.copyload = load i64, i64* %src.sroa.3.0..sroa_idx33, align 8
%src.sroa.4.0..sroa_idx34 = getelementptr inbounds [32 x i64], [32 x i64]* %1, i32 0, i32 3
%src.sroa.4.0.copyload = load i64, i64* %src.sroa.4.0..sroa_idx34, align 8
%src.sroa.5.0..sroa_idx35 = getelementptr inbounds [32 x i64], [32 x i64]* %1, i32 0, i32 4
%src.sroa.5.0.copyload = load i64, i64* %src.sroa.5.0..sroa_idx35, align 8
%src.sroa.6.0..sroa_idx36 = getelementptr inbounds [32 x i64], [32 x i64]* %1, i32 0, i32 5
%src.sroa.6.0.copyload = load i64, i64* %src.sroa.6.0..sroa_idx36, align 8
%src.sroa.7.0..sroa_idx37 = getelementptr inbounds [32 x i64], [32 x i64]* %1, i32 0, i32 6
%src.sroa.7.0.copyload = load i64, i64* %src.sroa.7.0..sroa_idx37, align 8
%src.sroa.8.0..sroa_idx38 = getelementptr inbounds [32 x i64], [32 x i64]* %1, i32 0, i32 7
%src.sroa.8.0.copyload = load i64, i64* %src.sroa.8.0..sroa_idx38, align 8
%src.sroa.9.0..sroa_idx39 = getelementptr inbounds [32 x i64], [32 x i64]* %1, i32 0, i32 8
%src.sroa.9.0.copyload = load i64, i64* %src.sroa.9.0..sroa_idx39, align 8
%src.sroa.10.0..sroa_idx40 = getelementptr inbounds [32 x i64], [32 x i64]* %1, i32 0, i32 9
%src.sroa.10.0.copyload = load i64, i64* %src.sroa.10.0..sroa_idx40, align 8
%src.sroa.11.0..sroa_idx41 = getelementptr inbounds [32 x i64], [32 x i64]* %1, i32 0, i32 10
%src.sroa.11.0.copyload = load i64, i64* %src.sroa.11.0..sroa_idx41, align 8
%src.sroa.12.0..sroa_idx42 = getelementptr inbounds [32 x i64], [32 x i64]* %1, i32 0, i32 11
%src.sroa.12.0.copyload = load i64, i64* %src.sroa.12.0..sroa_idx42, align 8
%src.sroa.13.0..sroa_idx43 = getelementptr inbounds [32 x i64], [32 x i64]* %1, i32 0, i32 12
%src.sroa.13.0.copyload = load i64, i64* %src.sroa.13.0..sroa_idx43, align 8
%src.sroa.14.0..sroa_idx44 = getelementptr inbounds [32 x i64], [32 x i64]* %1, i32 0, i32 13
%src.sroa.14.0.copyload = load i64, i64* %src.sroa.14.0..sroa_idx44, align 8
%src.sroa.15.0..sroa_idx45 = getelementptr inbounds [32 x i64], [32 x i64]* %1, i32 0, i32 14
%src.sroa.15.0.copyload = load i64, i64* %src.sroa.15.0..sroa_idx45, align 8
%src.sroa.16.0..sroa_idx46 = getelementptr inbounds [32 x i64], [32 x i64]* %1, i32 0, i32 15
%src.sroa.16.0.copyload = load i64, i64* %src.sroa.16.0..sroa_idx46, align 8
%src.sroa.17.0..sroa_idx47 = getelementptr inbounds [32 x i64], [32 x i64]* %1, i32 0, i32 16
%src.sroa.17.0.copyload = load i64, i64* %src.sroa.17.0..sroa_idx47, align 8
%src.sroa.18.0..sroa_idx48 = getelementptr inbounds [32 x i64], [32 x i64]* %1, i32 0, i32 17
%src.sroa.18.0.copyload = load i64, i64* %src.sroa.18.0..sroa_idx48, align 8
%src.sroa.19.0..sroa_idx49 = getelementptr inbounds [32 x i64], [32 x i64]* %1, i32 0, i32 18
%src.sroa.19.0.copyload = load i64, i64* %src.sroa.19.0..sroa_idx49, align 8
%src.sroa.20.0..sroa_idx50 = getelementptr inbounds [32 x i64], [32 x i64]* %1, i32 0, i32 19
%src.sroa.20.0.copyload = load i64, i64* %src.sroa.20.0..sroa_idx50, align 8
%src.sroa.21.0..sroa_idx51 = getelementptr inbounds [32 x i64], [32 x i64]* %1, i32 0, i32 20
%src.sroa.21.0.copyload = load i64, i64* %src.sroa.21.0..sroa_idx51, align 8
%src.sroa.22.0..sroa_idx52 = getelementptr inbounds [32 x i64], [32 x i64]* %1, i32 0, i32 21
%src.sroa.22.0.copyload = load i64, i64* %src.sroa.22.0..sroa_idx52, align 8
%src.sroa.23.0..sroa_idx53 = getelementptr inbounds [32 x i64], [32 x i64]* %1, i32 0, i32 22
%src.sroa.23.0.copyload = load i64, i64* %src.sroa.23.0..sroa_idx53, align 8
%src.sroa.24.0..sroa_idx54 = getelementptr inbounds [32 x i64], [32 x i64]* %1, i32 0, i32 23
%src.sroa.24.0.copyload = load i64, i64* %src.sroa.24.0..sroa_idx54, align 8
%src.sroa.25.0..sroa_idx55 = getelementptr inbounds [32 x i64], [32 x i64]* %1, i32 0, i32 24
%src.sroa.25.0.copyload = load i64, i64* %src.sroa.25.0..sroa_idx55, align 8
%src.sroa.26.0..sroa_idx56 = getelementptr inbounds [32 x i64], [32 x i64]* %1, i32 0, i32 25
%src.sroa.26.0.copyload = load i64, i64* %src.sroa.26.0..sroa_idx56, align 8
%src.sroa.27.0..sroa_idx57 = getelementptr inbounds [32 x i64], [32 x i64]* %1, i32 0, i32 26
%src.sroa.27.0.copyload = load i64, i64* %src.sroa.27.0..sroa_idx57, align 8
%src.sroa.28.0..sroa_idx58 = getelementptr inbounds [32 x i64], [32 x i64]* %1, i32 0, i32 27
%src.sroa.28.0.copyload = load i64, i64* %src.sroa.28.0..sroa_idx58, align 8
%src.sroa.29.0..sroa_idx59 = getelementptr inbounds [32 x i64], [32 x i64]* %1, i32 0, i32 28
%src.sroa.29.0.copyload = load i64, i64* %src.sroa.29.0..sroa_idx59, align 8
%src.sroa.30.0..sroa_idx60 = getelementptr inbounds [32 x i64], [32 x i64]* %1, i32 0, i32 29
%src.sroa.30.0.copyload = load i64, i64* %src.sroa.30.0..sroa_idx60, align 8
%src.sroa.31.0..sroa_idx61 = getelementptr inbounds [32 x i64], [32 x i64]* %1, i32 0, i32 30
%src.sroa.31.0.copyload = load i64, i64* %src.sroa.31.0..sroa_idx61, align 8
%src.sroa.32.0..sroa_idx62 = getelementptr inbounds [32 x i64], [32 x i64]* %1, i32 0, i32 31
%src.sroa.32.0.copyload = load i64, i64* %src.sroa.32.0..sroa_idx62, align 8
%.fca.0.insert = insertvalue [32 x i64] undef, i64 %src.sroa.0.0.copyload, 0
%.fca.1.insert = insertvalue [32 x i64] %.fca.0.insert, i64 %src.sroa.2.0.copyload, 1
%.fca.2.insert = insertvalue [32 x i64] %.fca.1.insert, i64 %src.sroa.3.0.copyload, 2
%.fca.3.insert = insertvalue [32 x i64] %.fca.2.insert, i64 %src.sroa.4.0.copyload, 3
%.fca.4.insert = insertvalue [32 x i64] %.fca.3.insert, i64 %src.sroa.5.0.copyload, 4
%.fca.5.insert = insertvalue [32 x i64] %.fca.4.insert, i64 %src.sroa.6.0.copyload, 5
%.fca.6.insert = insertvalue [32 x i64] %.fca.5.insert, i64 %src.sroa.7.0.copyload, 6
%.fca.7.insert = insertvalue [32 x i64] %.fca.6.insert, i64 %src.sroa.8.0.copyload, 7
%.fca.8.insert = insertvalue [32 x i64] %.fca.7.insert, i64 %src.sroa.9.0.copyload, 8
%.fca.9.insert = insertvalue [32 x i64] %.fca.8.insert, i64 %src.sroa.10.0.copyload, 9
%.fca.10.insert = insertvalue [32 x i64] %.fca.9.insert, i64 %src.sroa.11.0.copyload, 10
%.fca.11.insert = insertvalue [32 x i64] %.fca.10.insert, i64 %src.sroa.12.0.copyload, 11
%.fca.12.insert = insertvalue [32 x i64] %.fca.11.insert, i64 %src.sroa.13.0.copyload, 12
%.fca.13.insert = insertvalue [32 x i64] %.fca.12.insert, i64 %src.sroa.14.0.copyload, 13
%.fca.14.insert = insertvalue [32 x i64] %.fca.13.insert, i64 %src.sroa.15.0.copyload, 14
%.fca.15.insert = insertvalue [32 x i64] %.fca.14.insert, i64 %src.sroa.16.0.copyload, 15
%.fca.16.insert = insertvalue [32 x i64] %.fca.15.insert, i64 %src.sroa.17.0.copyload, 16
%.fca.17.insert = insertvalue [32 x i64] %.fca.16.insert, i64 %src.sroa.18.0.copyload, 17
%.fca.18.insert = insertvalue [32 x i64] %.fca.17.insert, i64 %src.sroa.19.0.copyload, 18
%.fca.19.insert = insertvalue [32 x i64] %.fca.18.insert, i64 %src.sroa.20.0.copyload, 19
%.fca.20.insert = insertvalue [32 x i64] %.fca.19.insert, i64 %src.sroa.21.0.copyload, 20
%.fca.21.insert = insertvalue [32 x i64] %.fca.20.insert, i64 %src.sroa.22.0.copyload, 21
%.fca.22.insert = insertvalue [32 x i64] %.fca.21.insert, i64 %src.sroa.23.0.copyload, 22
%.fca.23.insert = insertvalue [32 x i64] %.fca.22.insert, i64 %src.sroa.24.0.copyload, 23
%.fca.24.insert = insertvalue [32 x i64] %.fca.23.insert, i64 %src.sroa.25.0.copyload, 24
%.fca.25.insert = insertvalue [32 x i64] %.fca.24.insert, i64 %src.sroa.26.0.copyload, 25
%.fca.26.insert = insertvalue [32 x i64] %.fca.25.insert, i64 %src.sroa.27.0.copyload, 26
%.fca.27.insert = insertvalue [32 x i64] %.fca.26.insert, i64 %src.sroa.28.0.copyload, 27
%.fca.28.insert = insertvalue [32 x i64] %.fca.27.insert, i64 %src.sroa.29.0.copyload, 28
%.fca.29.insert = insertvalue [32 x i64] %.fca.28.insert, i64 %src.sroa.30.0.copyload, 29
%.fca.30.insert = insertvalue [32 x i64] %.fca.29.insert, i64 %src.sroa.31.0.copyload, 30
%.fca.31.insert = insertvalue [32 x i64] %.fca.30.insert, i64 %src.sroa.32.0.copyload, 31
store volatile [32 x i64] %.fca.31.insert, [32 x i64]* %0, align 8
ret void
}
; Function Attrs: noreturn
define internal void @_ZN3val4main17h39db3226b090c3efE() unnamed_addr #1 {
slice_loop_body1:
%_6 = alloca [32 x i64], align 8
%x = alloca [32 x i64], align 8
%x4 = bitcast [32 x i64]* %x to i8*
call void @llvm.memset.p0i8.i32(i8* nonnull %x4, i8 0, i32 256, i32 8, i1 false)
%0 = getelementptr inbounds [32 x i64], [32 x i64]* %_6, i32 0, i32 0
store i64 1, i64* %0, align 8
%1 = getelementptr inbounds [32 x i64], [32 x i64]* %_6, i32 0, i32 1
store i64 1, i64* %1, align 8
%2 = getelementptr inbounds [32 x i64], [32 x i64]* %_6, i32 0, i32 2
store i64 1, i64* %2, align 8
%3 = getelementptr inbounds [32 x i64], [32 x i64]* %_6, i32 0, i32 3
store i64 1, i64* %3, align 8
%4 = getelementptr inbounds [32 x i64], [32 x i64]* %_6, i32 0, i32 4
store i64 1, i64* %4, align 8
%5 = getelementptr inbounds [32 x i64], [32 x i64]* %_6, i32 0, i32 5
store i64 1, i64* %5, align 8
%6 = getelementptr inbounds [32 x i64], [32 x i64]* %_6, i32 0, i32 6
store i64 1, i64* %6, align 8
%7 = getelementptr inbounds [32 x i64], [32 x i64]* %_6, i32 0, i32 7
store i64 1, i64* %7, align 8
%8 = getelementptr inbounds [32 x i64], [32 x i64]* %_6, i32 0, i32 8
store i64 1, i64* %8, align 8
%9 = getelementptr inbounds [32 x i64], [32 x i64]* %_6, i32 0, i32 9
store i64 1, i64* %9, align 8
%10 = getelementptr inbounds [32 x i64], [32 x i64]* %_6, i32 0, i32 10
store i64 1, i64* %10, align 8
%11 = getelementptr inbounds [32 x i64], [32 x i64]* %_6, i32 0, i32 11
store i64 1, i64* %11, align 8
%12 = getelementptr inbounds [32 x i64], [32 x i64]* %_6, i32 0, i32 12
store i64 1, i64* %12, align 8
%13 = getelementptr inbounds [32 x i64], [32 x i64]* %_6, i32 0, i32 13
store i64 1, i64* %13, align 8
%14 = getelementptr inbounds [32 x i64], [32 x i64]* %_6, i32 0, i32 14
store i64 1, i64* %14, align 8
%15 = getelementptr inbounds [32 x i64], [32 x i64]* %_6, i32 0, i32 15
store i64 1, i64* %15, align 8
%16 = getelementptr inbounds [32 x i64], [32 x i64]* %_6, i32 0, i32 16
store i64 1, i64* %16, align 8
%17 = getelementptr inbounds [32 x i64], [32 x i64]* %_6, i32 0, i32 17
store i64 1, i64* %17, align 8
%18 = getelementptr inbounds [32 x i64], [32 x i64]* %_6, i32 0, i32 18
store i64 1, i64* %18, align 8
%19 = getelementptr inbounds [32 x i64], [32 x i64]* %_6, i32 0, i32 19
store i64 1, i64* %19, align 8
%20 = getelementptr inbounds [32 x i64], [32 x i64]* %_6, i32 0, i32 20
store i64 1, i64* %20, align 8
%21 = getelementptr inbounds [32 x i64], [32 x i64]* %_6, i32 0, i32 21
store i64 1, i64* %21, align 8
%22 = getelementptr inbounds [32 x i64], [32 x i64]* %_6, i32 0, i32 22
store i64 1, i64* %22, align 8
%23 = getelementptr inbounds [32 x i64], [32 x i64]* %_6, i32 0, i32 23
store i64 1, i64* %23, align 8
%24 = getelementptr inbounds [32 x i64], [32 x i64]* %_6, i32 0, i32 24
store i64 1, i64* %24, align 8
%25 = getelementptr inbounds [32 x i64], [32 x i64]* %_6, i32 0, i32 25
store i64 1, i64* %25, align 8
%26 = getelementptr inbounds [32 x i64], [32 x i64]* %_6, i32 0, i32 26
store i64 1, i64* %26, align 8
%27 = getelementptr inbounds [32 x i64], [32 x i64]* %_6, i32 0, i32 27
store i64 1, i64* %27, align 8
%28 = getelementptr inbounds [32 x i64], [32 x i64]* %_6, i32 0, i32 28
store i64 1, i64* %28, align 8
%29 = getelementptr inbounds [32 x i64], [32 x i64]* %_6, i32 0, i32 29
store i64 1, i64* %29, align 8
%30 = getelementptr inbounds [32 x i64], [32 x i64]* %_6, i32 0, i32 30
store i64 1, i64* %30, align 8
%31 = getelementptr inbounds [32 x i64], [32 x i64]* %_6, i32 0, i32 31
store i64 1, i64* %31, align 8
call fastcc void @_ZN4core3ptr14write_volatile17hbd022764e1ac0bafE([32 x i64]* nonnull %x, [32 x i64]* noalias nocapture nonnull dereferenceable(256) %_6)
br label %bb5
bb2: ; preds = %bb5
%32 = icmp ugt i32 %36, 31
br i1 %32, label %bb3, label %bb5
bb3: ; preds = %bb2
call void @_ZN3std7process4exit17hffedc4a49948f761E(i32 0)
unreachable
bb5: ; preds = %slice_loop_body1, %bb2
%i.03 = phi i32 [ 0, %slice_loop_body1 ], [ %36, %bb2 ]
%33 = getelementptr inbounds [32 x i64], [32 x i64]* %x, i32 0, i32 %i.03
%34 = load i64, i64* %33, align 8
%35 = icmp eq i64 %34, 1
%36 = add nuw nsw i32 %i.03, 1
br i1 %35, label %bb2, label %bb6
bb6: ; preds = %bb5
call void @_ZN3std7process4exit17hffedc4a49948f761E(i32 1)
unreachable
}
declare i32 @rust_eh_personality(...) unnamed_addr
; Function Attrs: noreturn
declare void @_ZN3std7process4exit17hffedc4a49948f761E(i32) unnamed_addr #1
define i32 @main(i32, i8**) unnamed_addr {
top:
%2 = tail call i32 @_ZN3std2rt10lang_start17hb7fc7ec87b663023E(i8* bitcast (void ()* @_ZN3val4main17h39db3226b090c3efE to i8*), i32 %0, i8** %1)
ret i32 %2
}
declare i32 @_ZN3std2rt10lang_start17hb7fc7ec87b663023E(i8*, i32, i8**) unnamed_addr
; Function Attrs: argmemonly nounwind
declare void @llvm.memset.p0i8.i32(i8* nocapture writeonly, i8, i32, i32, i1) #2
attributes #0 = { inlinehint norecurse nounwind }
attributes #1 = { noreturn }
attributes #2 = { argmemonly nounwind }
!llvm.module.flags = !{!0}
!0 = !{i32 1, !"PIE Level", i32 2}
; ModuleID = 'val.cgu-0.rs'
source_filename = "val.cgu-0.rs"
target datalayout = "e-p:32:32-i64:64-v128:32:128-n32-S128"
target triple = "asmjs-unknown-emscripten"
%str_slice = type { i8*, i32 }
@str.0 = internal constant [6 x i8] c"val.rs"
@panic_bounds_check_loc.1 = internal unnamed_addr constant { %str_slice, i32 } { %str_slice { i8* getelementptr inbounds ([6 x i8], [6 x i8]* @str.0, i32 0, i32 0), i32 6 }, i32 13 }, align 4
; Function Attrs: inlinehint
define internal void @_ZN4core3ptr14write_volatile17hbd022764e1ac0bafE([32 x i64]*, [32 x i64]* noalias nocapture dereferenceable(256)) unnamed_addr #0 personality i32 (...)* @rust_eh_personality {
entry-block:
%personalityslot = alloca { i8*, i32 }
%_7 = alloca [32 x i64]
%src = alloca [32 x i64]
%_0 = alloca {}
br label %start
start: ; preds = %entry-block
%2 = bitcast [32 x i64]* %1 to i8*
%3 = bitcast [32 x i64]* %src to i8*
call void @llvm.memcpy.p0i8.p0i8.i32(i8* %3, i8* %2, i32 256, i32 8, i1 false)
%4 = bitcast [32 x i64]* %src to i8*
%5 = bitcast [32 x i64]* %_7 to i8*
call void @llvm.memcpy.p0i8.p0i8.i32(i8* %5, i8* %4, i32 256, i32 8, i1 false)
%6 = load [32 x i64], [32 x i64]* %_7
store volatile [32 x i64] %6, [32 x i64]* %0, align 8
br label %bb2
bb1: ; No predecessors!
%7 = load { i8*, i32 }, { i8*, i32 }* %personalityslot
resume { i8*, i32 } %7
bb2: ; preds = %start
ret void
}
define internal void @_ZN3val4main17h39db3226b090c3efE() unnamed_addr {
entry-block:
%_13 = alloca {}
%_10 = alloca {}
%_9 = alloca {}
%_8 = alloca {}
%i = alloca i32
%_6 = alloca [32 x i64]
%x = alloca [32 x i64]
br label %start
start: ; preds = %entry-block
%0 = getelementptr inbounds [32 x i64], [32 x i64]* %x, i32 0, i32 0
%1 = getelementptr inbounds i64, i64* %0, i32 32
br label %slice_loop_header
bb1: ; preds = %slice_loop_next2
store i32 0, i32* %i
br label %bb2
bb2: ; preds = %bb7, %bb1
%2 = load i32, i32* %i
%3 = icmp uge i32 %2, 32
br i1 %3, label %bb3, label %bb4
bb3: ; preds = %bb2
call void @_ZN3std7process4exit17hffedc4a49948f761E(i32 0)
unreachable
bb4: ; preds = %bb2
%4 = load i32, i32* %i
%5 = icmp ult i32 %4, 32
%6 = call i1 @llvm.expect.i1(i1 %5, i1 true)
br i1 %6, label %bb5, label %panic
bb5: ; preds = %bb4
%7 = getelementptr inbounds [32 x i64], [32 x i64]* %x, i32 0, i32 %4
%8 = load i64, i64* %7
%9 = icmp ne i64 %8, 1
br i1 %9, label %bb6, label %bb7
bb6: ; preds = %bb5
call void @_ZN3std7process4exit17hffedc4a49948f761E(i32 1)
unreachable
bb7: ; preds = %bb5
%10 = load i32, i32* %i
%11 = add i32 %10, 1
store i32 %11, i32* %i
br label %bb2
slice_loop_body: ; preds = %slice_loop_header
store i64 0, i64* %15
%12 = getelementptr inbounds i64, i64* %15, i32 1
br label %slice_loop_header
slice_loop_next: ; preds = %slice_loop_header
%13 = getelementptr inbounds [32 x i64], [32 x i64]* %_6, i32 0, i32 0
%14 = getelementptr inbounds i64, i64* %13, i32 32
br label %slice_loop_header3
slice_loop_header: ; preds = %slice_loop_body, %start
%15 = phi i64* [ %0, %start ], [ %12, %slice_loop_body ]
%16 = icmp ne i64* %15, %1
br i1 %16, label %slice_loop_body, label %slice_loop_next
slice_loop_body1: ; preds = %slice_loop_header3
store i64 1, i64* %18
%17 = getelementptr inbounds i64, i64* %18, i32 1
br label %slice_loop_header3
slice_loop_next2: ; preds = %slice_loop_header3
call void @_ZN4core3ptr14write_volatile17hbd022764e1ac0bafE([32 x i64]* %x, [32 x i64]* noalias nocapture dereferenceable(256) %_6)
br label %bb1
slice_loop_header3: ; preds = %slice_loop_body1, %slice_loop_next
%18 = phi i64* [ %13, %slice_loop_next ], [ %17, %slice_loop_body1 ]
%19 = icmp ne i64* %18, %14
br i1 %19, label %slice_loop_body1, label %slice_loop_next2
panic: ; preds = %bb4
call void @_ZN4core9panicking18panic_bounds_check17hfe212d6249b1c656E({ %str_slice, i32 }* @panic_bounds_check_loc.1, i32 %4, i32 32)
unreachable
}
declare i32 @rust_eh_personality(...) unnamed_addr
; Function Attrs: argmemonly nounwind
declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture writeonly, i8* nocapture readonly, i32, i32, i1) #1
; Function Attrs: noreturn
declare void @_ZN3std7process4exit17hffedc4a49948f761E(i32) unnamed_addr #2
; Function Attrs: nounwind readnone
declare i1 @llvm.expect.i1(i1, i1) #3
; Function Attrs: cold noinline noreturn
declare void @_ZN4core9panicking18panic_bounds_check17hfe212d6249b1c656E({ %str_slice, i32 }* noalias readonly dereferenceable(12), i32, i32) unnamed_addr #4
define i32 @main(i32, i8**) unnamed_addr {
top:
%2 = call i32 @_ZN3std2rt10lang_start17hb7fc7ec87b663023E(i8* bitcast (void ()* @_ZN3val4main17h39db3226b090c3efE to i8*), i32 %0, i8** %1)
ret i32 %2
}
declare i32 @_ZN3std2rt10lang_start17hb7fc7ec87b663023E(i8*, i32, i8**) unnamed_addr
attributes #0 = { inlinehint }
attributes #1 = { argmemonly nounwind }
attributes #2 = { noreturn }
attributes #3 = { nounwind readnone }
attributes #4 = { cold noinline noreturn }
!llvm.module.flags = !{!0}
!0 = !{i32 1, !"PIE Level", i32 2}
use std::ptr::write_volatile;
fn main() {
unsafe {
let mut x = [0u64; 32];
write_volatile(&mut x, [1; 32]);
let mut i = 0;
loop {
if i >= 32 { break; }
if x[i] != 1 {
::std::process::exit(1);
}
i += 1;
}
::std::process::exit(0);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment