Skip to content

Instantly share code, notes, and snippets.

@vchuravy
Created December 16, 2020 18:55
Show Gist options
  • Save vchuravy/b95aca54a4bdb6a1d386e5c5d5c27bc0 to your computer and use it in GitHub Desktop.
Save vchuravy/b95aca54a4bdb6a1d386e5c5d5c27bc0 to your computer and use it in GitHub Desktop.
Standalone reproducer
; ModuleID = 'check.ll'
source_filename = "check"
target datalayout = "e-m:e-i64:64-n32:64"
target triple = "powerpc64le-unknown-linux-gnu"
@0 = private unnamed_addr constant [1 x <4 x i64>] [<4 x i64> <i64 16, i64 17, i64 18, i64 19>]
define i8 @main() {
%1 = call i8 @check([1 x <4 x i64>]* nocapture readonly @0)
ret i8 %1
}
; Function Attrs: noinline sspstrong
define i8 @check([1 x <4 x i64>]* nocapture nonnull readonly align 16 dereferenceable(32) %0) #0 {
%2 = alloca [720 x i8], align 16
%3 = alloca [1 x <4 x i64>], align 32
%4 = alloca <4 x i64>, align 32
%5 = alloca i8, align 1
%6 = getelementptr inbounds [720 x i8], [720 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [1 x <4 x i64>], [1 x <4 x i64>]* %0, i64 0, i64 0
%8 = load <4 x i64>, <4 x i64>* %7, align 16, !tbaa !2
%9 = getelementptr inbounds [1 x <4 x i64>], [1 x <4 x i64>]* %3, i64 0, i64 0
br label %10
10: ; preds = %26, %1
%11 = phi <4 x i64> [ %8, %1 ], [ %23, %26 ]
%12 = phi i64 [ 1, %1 ], [ %27, %26 ]
%13 = phi i8 [ 1, %1 ], [ %24, %26 ]
store <4 x i64> %11, <4 x i64>* %9, align 32
%14 = call i64 @jl_excstack_state()
call void @llvm.lifetime.start.p0i8(i64 720, i8* nonnull %6)
call void @jl_enter_handler(i8* nonnull %6)
%15 = call i32 @__sigsetjmp(i8* nonnull %6, i32 0) #3
%16 = icmp eq i32 %15, 0
br i1 %16, label %29, label %17
17: ; preds = %10
%18 = bitcast <4 x i64>* %4 to [1 x <4 x i64>]*
%19 = load volatile [1 x <4 x i64>], [1 x <4 x i64>]* %18, align 32
%20 = extractvalue [1 x <4 x i64>] %19, 0
%21 = load volatile i8, i8* %5, align 1
call void @jl_pop_handler(i32 1)
call void @llvm.lifetime.end.p0i8(i64 720, i8* nonnull %6)
call void @jl_restore_excstack(i64 %14)
br label %22
22: ; preds = %29, %17
%23 = phi <4 x i64> [ %39, %29 ], [ %20, %17 ]
%24 = phi i8 [ %38, %29 ], [ %21, %17 ]
%25 = icmp eq i64 %12, 4
br i1 %25, label %28, label %26
26: ; preds = %22
%27 = add nuw nsw i64 %12, 1
br label %10
28: ; preds = %22
ret i8 %24
29: ; preds = %10
%30 = load volatile <4 x i64>, <4 x i64>* %9, align 32, !tbaa !6
store volatile <4 x i64> %30, <4 x i64>* %4, align 32, !tbaa !6
store volatile i8 %13, i8* %5, align 1, !tbaa !6
%31 = add nsw i64 %12, -1
%32 = getelementptr inbounds [1 x <4 x i64>], [1 x <4 x i64>]* %3, i64 0, i64 0, i64 %31
%33 = add nuw nsw i64 %12, 15
%34 = load i64, i64* %32, align 8, !tbaa !6
%35 = icmp eq i64 %34, %33
%36 = zext i1 %35 to i8
%37 = and i8 %13, 1
%38 = or i8 %37, %36
store volatile i8 %38, i8* %5, align 1, !tbaa !6
call void @jl_pop_handler(i32 1)
call void @llvm.lifetime.end.p0i8(i64 720, i8* nonnull %6)
%39 = load <4 x i64>, <4 x i64>* %9, align 32, !tbaa !6
br label %22
}
; Function Attrs: nounwind readnone speculatable willreturn
declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
; Function Attrs: argmemonly nounwind willreturn
declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #2
; Function Attrs: argmemonly nounwind willreturn
declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture) #2
define i64 @jl_excstack_state() {
ret i64 0
}
define void @jl_pop_handler(i32 %0) {
ret void
}
define void @jl_restore_excstack(i64 %0) {
ret void
}
; Function Attrs: argmemonly nounwind willreturn
declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture) #2
define void @jl_enter_handler(i8* %0) {
ret void
}
; Function Attrs: returns_twice
declare i32 @__sigsetjmp(i8*, i32) #3
; Function Attrs: inaccessiblemem_or_argmemonly
declare void @jl_gc_queue_root({} addrspace(10)*) #4
; Function Attrs: allocsize(1)
declare noalias nonnull {} addrspace(10)* @jl_gc_pool_alloc(i8*, i32, i32) #5
; Function Attrs: allocsize(1)
declare noalias nonnull {} addrspace(10)* @jl_gc_big_alloc(i8*, i64) #5
declare noalias nonnull {} addrspace(10)** @julia.new_gc_frame(i32)
declare void @julia.push_gc_frame({} addrspace(10)**, i32)
declare {} addrspace(10)** @julia.get_gc_frame_slot({} addrspace(10)**, i32)
declare void @julia.pop_gc_frame({} addrspace(10)**)
; Function Attrs: argmemonly nounwind willreturn writeonly
declare void @llvm.memset.p0i8.i32(i8* nocapture writeonly, i8, i32, i1 immarg) #6
attributes #0 = { noinline sspstrong }
attributes #1 = { nounwind readnone speculatable willreturn }
attributes #2 = { argmemonly nounwind willreturn }
attributes #3 = { returns_twice }
attributes #4 = { inaccessiblemem_or_argmemonly }
attributes #5 = { allocsize(1) }
attributes #6 = { argmemonly nounwind willreturn writeonly }
!llvm.module.flags = !{!0, !1}
!0 = !{i32 2, !"Dwarf Version", i32 4}
!1 = !{i32 1, !"Debug Info Version", i32 3}
!2 = !{!3, !3, i64 0}
!3 = !{!"jtbaa_const", !4, i64 0}
!4 = !{!"jtbaa", !5, i64 0}
!5 = !{!"jtbaa"}
!6 = !{!7, !7, i64 0}
!7 = !{!"jtbaa_stack", !4, i64 0}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment