EnzymeAD / Enzyme.jl

Julia bindings for the Enzyme automatic differentiator
https://enzyme.mit.edu
MIT License
439 stars 62 forks source link

Support for jl_eqtable_get #416

Closed ryanstoner1 closed 1 year ago

ryanstoner1 commented 2 years ago

A MWE of the issue I mentioned in the zoom call today:

a = [1.0]
da = [0.0]
function f(x); y = copy(x); return sum(y); end
function g(x); y = deepcopy(x); return sum(y); end
Enzyme.autodiff(f, Duplicated(a,da))
@show da
da = [0.0]
Enzyme.autodiff(g, Duplicated(a,da))
ryanstoner1 commented 2 years ago

Full error message:

ERROR: Enzyme compilation failed.
Current scope: 
; ModuleID = 'text'
source_filename = "text"
target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128-ni:10:11:12:13"
target triple = "x86_64-apple-darwin21.4.0"

@_j_str1 = private unnamed_addr constant [11 x i8] c"typeassert\00"

; Function Attrs: readnone
declare {}*** @julia.get_pgcstack() local_unnamed_addr #0

; Function Attrs: inaccessiblememonly allocsize(1)
declare noalias nonnull {} addrspace(10)* @julia.gc_alloc_obj(i8*, i64, {} addrspace(10)*) local_unnamed_addr #1

declare nonnull {} addrspace(10)* @jl_invoke({} addrspace(10)*, {} addrspace(10)** nocapture readonly, i32, {} addrspace(10)*) local_unnamed_addr

; Function Attrs: noreturn
declare void @jl_throw({} addrspace(12)*) local_unnamed_addr #2

; Function Attrs: noinline nosync readonly
define internal fastcc double @julia_mapreduce_impl_3112({} addrspace(10)* nocapture nonnull readonly align 16 dereferenceable(40) %0, i64 signext %1, i64 signext %2) unnamed_addr #3 !dbg !11 {
top:
  %3 = call {}*** @julia.get_pgcstack()
  %.not = icmp eq i64 %2, %1, !dbg !13
  br i1 %.not, label %L3, label %L5, !dbg !16

L3:                                               ; preds = %top
  %4 = add i64 %2, -1, !dbg !17
  %5 = bitcast {} addrspace(10)* %0 to double addrspace(13)* addrspace(10)*, !dbg !17
  %6 = addrspacecast double addrspace(13)* addrspace(10)* %5 to double addrspace(13)* addrspace(11)*, !dbg !17
  %7 = load double addrspace(13)*, double addrspace(13)* addrspace(11)* %6, align 16, !dbg !17, !tbaa !21, !nonnull !4
  %8 = getelementptr inbounds double, double addrspace(13)* %7, i64 %4, !dbg !17
  %9 = load double, double addrspace(13)* %8, align 8, !dbg !17, !tbaa !26
  ret double %9, !dbg !29

L5:                                               ; preds = %top
  %10 = sub i64 %2, %1, !dbg !30
  %.not10 = icmp slt i64 %10, 1024, !dbg !34
  br i1 %.not10, label %L8, label %L54, !dbg !33

L8:                                               ; preds = %L5
  %11 = add i64 %1, -1, !dbg !36
  %12 = bitcast {} addrspace(10)* %0 to double addrspace(13)* addrspace(10)*, !dbg !36
  %13 = addrspacecast double addrspace(13)* addrspace(10)* %12 to double addrspace(13)* addrspace(11)*, !dbg !36
  %14 = load double addrspace(13)*, double addrspace(13)* addrspace(11)* %13, align 16, !dbg !36, !tbaa !21, !nonnull !4
  %15 = getelementptr inbounds double, double addrspace(13)* %14, i64 %11, !dbg !36
  %16 = load double, double addrspace(13)* %15, align 8, !dbg !36, !tbaa !26
  %17 = getelementptr inbounds double, double addrspace(13)* %14, i64 %1, !dbg !38
  %18 = load double, double addrspace(13)* %17, align 8, !dbg !38, !tbaa !26
  %19 = fadd double %16, %18, !dbg !40
  %20 = add i64 %1, 2, !dbg !46
  %.not11 = icmp sgt i64 %20, %2, !dbg !52
  %21 = add i64 %1, 1, !dbg !64
  %22 = select i1 %.not11, i64 %21, i64 %2, !dbg !57
  %23 = sub i64 %22, %20, !dbg !65
  %24 = add i64 %23, 1, !dbg !71
  %25 = icmp slt i64 %24, 1, !dbg !73
  br i1 %25, label %L52, label %L27, !dbg !74

L27:                                              ; preds = %L8, %L27
  %value_phi115 = phi i64 [ %30, %L27 ], [ 0, %L8 ]
  %value_phi14 = phi double [ %29, %L27 ], [ %19, %L8 ]
  %26 = add i64 %21, %value_phi115, !dbg !75
  %27 = getelementptr inbounds double, double addrspace(13)* %14, i64 %26, !dbg !75
  %28 = load double, double addrspace(13)* %27, align 8, !dbg !75, !tbaa !26
  %29 = fadd fast double %value_phi14, %28, !dbg !79
  %30 = add nuw nsw i64 %value_phi115, 1, !dbg !82
  %exitcond.not = icmp eq i64 %value_phi115, %23, !dbg !84
  br i1 %exitcond.not, label %L52, label %L27, !dbg !85, !llvm.loop !86

L52:                                              ; preds = %L27, %L8
  %value_phi3 = phi double [ %19, %L8 ], [ %29, %L27 ]
  ret double %value_phi3, !dbg !87

L54:                                              ; preds = %L5
  %31 = ashr i64 %10, 1, !dbg !88
  %32 = add i64 %31, %1, !dbg !92
  %33 = call fastcc double @julia_mapreduce_impl_3112({} addrspace(10)* nocapture nonnull readonly align 16 dereferenceable(40) %0, i64 signext %1, i64 signext %32) #3, !dbg !93
  %34 = add i64 %32, 1, !dbg !94
  %35 = call fastcc double @julia_mapreduce_impl_3112({} addrspace(10)* nocapture nonnull readonly align 16 dereferenceable(40) %0, i64 signext %34, i64 signext %2) #3, !dbg !95
  %36 = fadd double %33, %35, !dbg !96
  ret double %36, !dbg !98
}

define internal fastcc nonnull {} addrspace(10)* @julia_deepcopy_3117({} addrspace(10)* nonnull align 16 dereferenceable(40) %0) unnamed_addr #4 !dbg !99 {
top:
  %1 = call {}*** @julia.get_pgcstack()
  %2 = call nonnull {} addrspace(10)* @jl_alloc_array_1d({} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 4693193712 to {}*) to {} addrspace(10)*), i64 noundef 32), !dbg !100
  %ptls_field11 = getelementptr inbounds {}**, {}*** %1, i64 2305843009213693954, !dbg !103
  %3 = bitcast {}*** %ptls_field11 to i8**, !dbg !103
  %ptls_load1213 = load i8*, i8** %3, align 8, !dbg !103, !tbaa !108
  %4 = call noalias nonnull {} addrspace(10)* @julia.gc_alloc_obj(i8* %ptls_load1213, i64 noundef 24, {} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 4693590064 to {}*) to {} addrspace(10)*)) #11, !dbg !103
  %5 = bitcast {} addrspace(10)* %4 to {} addrspace(10)* addrspace(10)*, !dbg !103
  %6 = addrspacecast {} addrspace(10)* addrspace(10)* %5 to {} addrspace(10)* addrspace(11)*, !dbg !103
  store {} addrspace(10)* null, {} addrspace(10)* addrspace(11)* %6, align 8, !dbg !103, !tbaa !110
  store {} addrspace(10)* %2, {} addrspace(10)* addrspace(10)* %5, align 8, !dbg !103, !tbaa !110
  %7 = bitcast {} addrspace(10)* %4 to i8 addrspace(10)*, !dbg !103
  %8 = addrspacecast i8 addrspace(10)* %7 to i8 addrspace(11)*, !dbg !103
  %9 = getelementptr inbounds i8, i8 addrspace(11)* %8, i64 8, !dbg !103
  call void @llvm.memset.p11i8.i64(i8 addrspace(11)* align 8 dereferenceable(16) %9, i8 noundef 0, i64 noundef 16, i1 noundef false), !dbg !103
  %10 = load atomic {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %6 unordered, align 8, !dbg !113, !tbaa !110, !nonnull !4, !dereferenceable !125, !align !126
  %11 = call nonnull {} addrspace(10)* @jl_eqtable_get({} addrspace(10)* nonnull %10, {} addrspace(10)* nonnull %0, {} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 4589640400 to {}*) to {} addrspace(10)*)), !dbg !116
  %12 = addrspacecast {} addrspace(10)* %11 to {} addrspace(11)*, !dbg !127
  %.not = icmp eq {} addrspace(11)* %12, addrspacecast ({}* inttoptr (i64 4589640400 to {}*) to {} addrspace(11)*), !dbg !127
  br i1 %.not, label %L29, label %L17, !dbg !123

L17:                                              ; preds = %top
  %13 = call nonnull {} addrspace(10)* @jl_eqtable_get({} addrspace(10)* nonnull %10, {} addrspace(10)* nonnull %0, {} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 4589640400 to {}*) to {} addrspace(10)*)), !dbg !128
  %14 = addrspacecast {} addrspace(10)* %13 to {} addrspace(11)*, !dbg !131
  %.not14 = icmp eq {} addrspace(11)* %14, addrspacecast ({}* inttoptr (i64 4589640400 to {}*) to {} addrspace(11)*), !dbg !131
  br i1 %.not14, label %L21, label %L26, !dbg !131

L21:                                              ; preds = %L17
  %ptls_load41718 = load i8*, i8** %3, align 8, !dbg !131, !tbaa !108
  %15 = call noalias nonnull {} addrspace(10)* @julia.gc_alloc_obj(i8* %ptls_load41718, i64 noundef 8, {} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 4745749536 to {}*) to {} addrspace(10)*)) #11, !dbg !131
  %16 = bitcast {} addrspace(10)* %15 to {} addrspace(10)* addrspace(10)*, !dbg !131
  store {} addrspace(10)* %0, {} addrspace(10)* addrspace(10)* %16, align 8, !dbg !131, !tbaa !132
  %17 = addrspacecast {} addrspace(10)* %15 to {} addrspace(12)*, !dbg !131
  call void @jl_throw({} addrspace(12)* %17) #2, !dbg !131
  unreachable, !dbg !131

L26:                                              ; preds = %L17
  %18 = call {} addrspace(10)* @julia.typeof({} addrspace(10)* nonnull %13) #12, !dbg !130
  %19 = icmp eq {} addrspace(10)* %18, addrspacecast ({}* inttoptr (i64 4701817328 to {}*) to {} addrspace(10)*), !dbg !130
  br i1 %19, label %L32, label %fail, !dbg !130

L29:                                              ; preds = %top
  %20 = call nonnull {} addrspace(10)* @jl_array_copy({} addrspace(10)* nonnull %0), !dbg !134
  %21 = call cc38 nonnull {} addrspace(10)* bitcast ({} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)**, i32, {} addrspace(10)*)* @jl_invoke to {} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*)*)({} addrspace(10)* addrspacecast ({}* inttoptr (i64 4699896688 to {}*) to {} addrspace(10)*), {} addrspace(10)* addrspacecast ({}* inttoptr (i64 4752928528 to {}*) to {} addrspace(10)*), {} addrspace(10)* nonnull %4, {} addrspace(10)* nonnull %20, {} addrspace(10)* nonnull %0), !dbg !136
  br label %L32, !dbg !138

L32:                                              ; preds = %L26, %L29
  %value_phi5 = phi {} addrspace(10)* [ %20, %L29 ], [ %13, %L26 ]
  ret {} addrspace(10)* %value_phi5, !dbg !107

fail:                                             ; preds = %L26
  %22 = addrspacecast {} addrspace(10)* %13 to {} addrspace(12)*, !dbg !130
  call void @jl_type_error(i8* noundef getelementptr inbounds ([11 x i8], [11 x i8]* @_j_str1, i64 0, i64 0), {} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 4701817328 to {}*) to {} addrspace(10)*), {} addrspace(12)* %22) #2, !dbg !130
  unreachable, !dbg !130
}

; Function Attrs: norecurse nounwind readnone
declare nonnull {} addrspace(10)* @julia.typeof({} addrspace(10)*) local_unnamed_addr #5

; Function Attrs: noreturn
declare void @jl_type_error(i8*, {} addrspace(10)*, {} addrspace(12)*) local_unnamed_addr #2

; Function Attrs: inaccessiblemem_or_argmemonly
declare noalias {} addrspace(10)* @jl_array_copy({} addrspace(10)*) local_unnamed_addr #6

declare {} addrspace(10)* @jl_eqtable_get({} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*) local_unnamed_addr

; Function Attrs: inaccessiblememonly
declare noalias {} addrspace(10)* @jl_alloc_array_1d({} addrspace(10)*, i64) local_unnamed_addr #7

define double @julia_g_3108_inner.1({} addrspace(10)* nonnull align 16 dereferenceable(40) %0) local_unnamed_addr #4 !dbg !139 {
entry:
  %1 = call {}*** @julia.get_pgcstack()
  %2 = call fastcc nonnull {} addrspace(10)* @julia_deepcopy_3117({} addrspace(10)* nonnull align 16 dereferenceable(40) %0) #4, !dbg !140
  %3 = bitcast {} addrspace(10)* %2 to {} addrspace(10)* addrspace(10)*, !dbg !142
  %4 = addrspacecast {} addrspace(10)* addrspace(10)* %3 to {} addrspace(10)* addrspace(11)*, !dbg !142
  %5 = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %4, i64 3, !dbg !142
  %6 = bitcast {} addrspace(10)* addrspace(11)* %5 to i64 addrspace(11)*, !dbg !142
  %7 = load i64, i64 addrspace(11)* %6, align 8, !dbg !142, !tbaa !170, !range !172
  switch i64 %7, label %L14.i [
    i64 0, label %julia_g_3108_inner.exit
    i64 1, label %L12.i
  ], !dbg !173

L12.i:                                            ; preds = %entry
  %8 = bitcast {} addrspace(10)* %2 to double addrspace(13)* addrspace(10)*, !dbg !174
  %9 = addrspacecast double addrspace(13)* addrspace(10)* %8 to double addrspace(13)* addrspace(11)*, !dbg !174
  %10 = load double addrspace(13)*, double addrspace(13)* addrspace(11)* %9, align 8, !dbg !174, !tbaa !21, !nonnull !4
  %11 = load double, double addrspace(13)* %10, align 8, !dbg !174, !tbaa !26
  br label %julia_g_3108_inner.exit, !dbg !177

L14.i:                                            ; preds = %entry
  %12 = icmp ugt i64 %7, 15, !dbg !178
  br i1 %12, label %L30.i, label %L16.i, !dbg !181

L16.i:                                            ; preds = %L14.i
  %13 = bitcast {} addrspace(10)* %2 to double addrspace(13)* addrspace(10)*, !dbg !182
  %14 = addrspacecast double addrspace(13)* addrspace(10)* %13 to double addrspace(13)* addrspace(11)*, !dbg !182
  %15 = load double addrspace(13)*, double addrspace(13)* addrspace(11)* %14, align 8, !dbg !182, !tbaa !21, !nonnull !4
  %16 = load double, double addrspace(13)* %15, align 8, !dbg !182, !tbaa !26
  %17 = getelementptr inbounds double, double addrspace(13)* %15, i64 1, !dbg !184
  %18 = load double, double addrspace(13)* %17, align 8, !dbg !184, !tbaa !26
  %19 = fadd double %16, %18, !dbg !186
  %.not34 = icmp ugt i64 %7, 2, !dbg !191
  br i1 %.not34, label %L25.i, label %julia_g_3108_inner.exit, !dbg !193

L25.i:                                            ; preds = %L16.i, %L25.i
  %value_phi2.i6 = phi i64 [ %20, %L25.i ], [ 2, %L16.i ]
  %value_phi1.i5 = phi double [ %23, %L25.i ], [ %19, %L16.i ]
  %20 = add nuw nsw i64 %value_phi2.i6, 1, !dbg !194
  %21 = getelementptr inbounds double, double addrspace(13)* %15, i64 %value_phi2.i6, !dbg !197
  %22 = load double, double addrspace(13)* %21, align 8, !dbg !197, !tbaa !26
  %23 = fadd double %value_phi1.i5, %22, !dbg !198
  %exitcond.not = icmp eq i64 %20, %7, !dbg !191
  br i1 %exitcond.not, label %julia_g_3108_inner.exit, label %L25.i, !dbg !193

L30.i:                                            ; preds = %L14.i
  %24 = call fastcc double @julia_mapreduce_impl_3112({} addrspace(10)* nocapture nonnull readonly align 16 dereferenceable(40) %2, i64 noundef signext 1, i64 signext %7) #13, !dbg !201
  br label %julia_g_3108_inner.exit, !dbg !204

julia_g_3108_inner.exit:                          ; preds = %L25.i, %L16.i, %entry, %L12.i, %L30.i
  %value_phi.i = phi double [ %11, %L12.i ], [ %24, %L30.i ], [ 0.000000e+00, %entry ], [ %19, %L16.i ], [ %23, %L25.i ]
  ret double %value_phi.i, !dbg !205
}

; Function Attrs: argmemonly nofree nosync nounwind willreturn
declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture) #8

; Function Attrs: argmemonly nofree nosync nounwind willreturn
declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture) #8

; Function Attrs: argmemonly nofree nosync nounwind willreturn writeonly
declare void @llvm.memset.p11i8.i64(i8 addrspace(11)* nocapture writeonly, i8, i64, i1 immarg) #9

; Function Attrs: willreturn mustprogress
define double @preprocess_julia_g_3108_inner.1({} addrspace(10)* nonnull align 16 dereferenceable(40) %0) local_unnamed_addr #10 !dbg !206 {
entry:
  %1 = call {}*** @julia.get_pgcstack() #14
  %2 = call fastcc nonnull {} addrspace(10)* @julia_deepcopy_3117({} addrspace(10)* nonnull align 16 dereferenceable(40) %0) #10, !dbg !207
  %3 = bitcast {} addrspace(10)* %2 to {} addrspace(10)* addrspace(10)*, !dbg !209
  %4 = addrspacecast {} addrspace(10)* addrspace(10)* %3 to {} addrspace(10)* addrspace(11)*, !dbg !209
  %5 = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %4, i64 3, !dbg !209
  %6 = bitcast {} addrspace(10)* addrspace(11)* %5 to i64 addrspace(11)*, !dbg !209
  %7 = load i64, i64 addrspace(11)* %6, align 8, !dbg !209, !tbaa !170, !range !172
  switch i64 %7, label %L14.i [
    i64 0, label %julia_g_3108_inner.exit
    i64 1, label %L12.i
  ], !dbg !223

L12.i:                                            ; preds = %entry
  %8 = bitcast {} addrspace(10)* %2 to double addrspace(13)* addrspace(10)*, !dbg !224
  %9 = addrspacecast double addrspace(13)* addrspace(10)* %8 to double addrspace(13)* addrspace(11)*, !dbg !224
  %10 = load double addrspace(13)*, double addrspace(13)* addrspace(11)* %9, align 8, !dbg !224, !tbaa !21, !nonnull !4
  %11 = load double, double addrspace(13)* %10, align 8, !dbg !224, !tbaa !26
  br label %julia_g_3108_inner.exit, !dbg !226

L14.i:                                            ; preds = %entry
  %12 = icmp ugt i64 %7, 15, !dbg !227
  br i1 %12, label %L30.i, label %L16.i, !dbg !229

L16.i:                                            ; preds = %L14.i
  %13 = bitcast {} addrspace(10)* %2 to double addrspace(13)* addrspace(10)*, !dbg !230
  %14 = addrspacecast double addrspace(13)* addrspace(10)* %13 to double addrspace(13)* addrspace(11)*, !dbg !230
  %15 = load double addrspace(13)*, double addrspace(13)* addrspace(11)* %14, align 8, !dbg !230, !tbaa !21, !nonnull !4
  %16 = load double, double addrspace(13)* %15, align 8, !dbg !230, !tbaa !26
  %17 = getelementptr inbounds double, double addrspace(13)* %15, i64 1, !dbg !232
  %18 = load double, double addrspace(13)* %17, align 8, !dbg !232, !tbaa !26
  %19 = fadd double %16, %18, !dbg !234
  %.not34 = icmp ugt i64 %7, 2, !dbg !237
  br i1 %.not34, label %L25.i.preheader, label %julia_g_3108_inner.exit, !dbg !239

L25.i.preheader:                                  ; preds = %L16.i
  br label %L25.i, !dbg !239

L25.i:                                            ; preds = %L25.i.preheader, %L25.i
  %iv = phi i64 [ %iv.next, %L25.i ], [ 0, %L25.i.preheader ]
  %value_phi1.i5 = phi double [ %24, %L25.i ], [ %19, %L25.i.preheader ]
  %20 = add i64 %iv, 2, !dbg !240
  %iv.next = add nuw nsw i64 %iv, 1, !dbg !240
  %21 = add nuw nsw i64 %20, 1, !dbg !240
  %22 = getelementptr inbounds double, double addrspace(13)* %15, i64 %20, !dbg !242
  %23 = load double, double addrspace(13)* %22, align 8, !dbg !242, !tbaa !26
  %24 = fadd double %value_phi1.i5, %23, !dbg !243
  %exitcond.not = icmp eq i64 %21, %7, !dbg !237
  br i1 %exitcond.not, label %julia_g_3108_inner.exit.loopexit, label %L25.i, !dbg !239

L30.i:                                            ; preds = %L14.i
  %25 = call fastcc double @julia_mapreduce_impl_3112({} addrspace(10)* nocapture nonnull readonly align 16 dereferenceable(40) %2, i64 noundef signext 1, i64 signext %7) #15, !dbg !246
  br label %julia_g_3108_inner.exit, !dbg !248

julia_g_3108_inner.exit.loopexit:                 ; preds = %L25.i
  br label %julia_g_3108_inner.exit, !dbg !249

julia_g_3108_inner.exit:                          ; preds = %julia_g_3108_inner.exit.loopexit, %L30.i, %L16.i, %L12.i, %entry
  %value_phi.i = phi double [ %11, %L12.i ], [ %25, %L30.i ], [ 0.000000e+00, %entry ], [ %19, %L16.i ], [ %24, %julia_g_3108_inner.exit.loopexit ]
  ret double %value_phi.i, !dbg !249
}

; Function Attrs: willreturn mustprogress
define internal void @diffejulia_g_3108_inner.1({} addrspace(10)* nonnull align 16 dereferenceable(40) %0, {} addrspace(10)* %"'", double %differeturn) local_unnamed_addr #10 !dbg !250 {
entry:
  %1 = call {}*** @julia.get_pgcstack() #14
  %2 = call fastcc nonnull {} addrspace(10)* @julia_deepcopy_3117({} addrspace(10)* nonnull align 16 dereferenceable(40) %0) #10, !dbg !251
  %"'ip_phi" = phi {} addrspace(10)* , !dbg !253
  %3 = bitcast {} addrspace(10)* %2 to {} addrspace(10)* addrspace(10)*, !dbg !253
  %4 = addrspacecast {} addrspace(10)* addrspace(10)* %3 to {} addrspace(10)* addrspace(11)*, !dbg !253
  %5 = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %4, i64 3, !dbg !253
  %6 = bitcast {} addrspace(10)* addrspace(11)* %5 to i64 addrspace(11)*, !dbg !253
  %7 = load i64, i64 addrspace(11)* %6, align 8, !dbg !253, !tbaa !170, !range !172
  switch i64 %7, label %L14.i [
    i64 0, label %julia_g_3108_inner.exit
    i64 1, label %L12.i
  ], !dbg !267

L12.i:                                            ; preds = %entry
  %8 = bitcast {} addrspace(10)* %2 to double addrspace(13)* addrspace(10)*, !dbg !268
  %9 = addrspacecast double addrspace(13)* addrspace(10)* %8 to double addrspace(13)* addrspace(11)*, !dbg !268
  %10 = load double addrspace(13)*, double addrspace(13)* addrspace(11)* %9, align 8, !dbg !268, !tbaa !21, !nonnull !4
  %"'il_phi" = phi double addrspace(13)* , !dbg !268
  %11 = load double, double addrspace(13)* %10, align 8, !dbg !268, !tbaa !26
  br label %julia_g_3108_inner.exit, !dbg !270

L14.i:                                            ; preds = %entry
  %12 = icmp ugt i64 %7, 15, !dbg !271
  br i1 %12, label %L30.i, label %L16.i, !dbg !273

L16.i:                                            ; preds = %L14.i
  %13 = bitcast {} addrspace(10)* %2 to double addrspace(13)* addrspace(10)*, !dbg !274
  %14 = addrspacecast double addrspace(13)* addrspace(10)* %13 to double addrspace(13)* addrspace(11)*, !dbg !274
  %15 = load double addrspace(13)*, double addrspace(13)* addrspace(11)* %14, align 8, !dbg !274, !tbaa !21, !nonnull !4
  %"'il_phi1" = phi double addrspace(13)* , !dbg !274
  %16 = load double, double addrspace(13)* %15, align 8, !dbg !274, !tbaa !26
  %17 = getelementptr inbounds double, double addrspace(13)* %15, i64 1, !dbg !276
  %18 = load double, double addrspace(13)* %17, align 8, !dbg !276, !tbaa !26
  %19 = fadd double %16, %18, !dbg !278
  %.not34 = icmp ugt i64 %7, 2, !dbg !281
  br i1 %.not34, label %L25.i.preheader, label %julia_g_3108_inner.exit, !dbg !283

L25.i.preheader:                                  ; preds = %L16.i
  %20 = add nsw i64 %7, -3, !dbg !283
  br label %L25.i, !dbg !283

L25.i:                                            ; preds = %L25.i, %L25.i.preheader
  %iv = phi i64 [ %iv.next, %L25.i ], [ 0, %L25.i.preheader ]
  %value_phi1.i5 = phi double [ %25, %L25.i ], [ %19, %L25.i.preheader ]
  %iv.next = add nuw nsw i64 %iv, 1, !dbg !284
  %21 = add i64 %iv, 2, !dbg !284
  %22 = add nuw nsw i64 %21, 1, !dbg !284
  %23 = getelementptr inbounds double, double addrspace(13)* %15, i64 %21, !dbg !286
  %24 = load double, double addrspace(13)* %23, align 8, !dbg !286, !tbaa !26
  %25 = fadd double %value_phi1.i5, %24, !dbg !287
  %exitcond.not = icmp eq i64 %22, %7, !dbg !281
  br i1 %exitcond.not, label %julia_g_3108_inner.exit.loopexit, label %L25.i, !dbg !283

L30.i:                                            ; preds = %L14.i
  %26 = call fastcc double @julia_mapreduce_impl_3112({} addrspace(10)* nocapture nonnull readonly align 16 dereferenceable(40) %2, i64 noundef signext 1, i64 signext %7) #15, !dbg !290
  br label %julia_g_3108_inner.exit, !dbg !292

julia_g_3108_inner.exit.loopexit:                 ; preds = %L25.i
  br label %julia_g_3108_inner.exit, !dbg !293

julia_g_3108_inner.exit:                          ; preds = %julia_g_3108_inner.exit.loopexit, %L30.i, %L16.i, %L12.i, %entry
  %value_phi.i = phi double [ %11, %L12.i ], [ %26, %L30.i ], [ 0.000000e+00, %entry ], [ %19, %L16.i ], [ %25, %julia_g_3108_inner.exit.loopexit ]
  br label %invertjulia_g_3108_inner.exit, !dbg !293

allocsForInversion:                               ; No predecessors!
  %"iv'ac" = alloca i64, align 8
  %"value_phi.i'de" = alloca double, align 8
  store double 0.000000e+00, double* %"value_phi.i'de", align 8

invertentry:                                      ; No predecessors!

invertL12.i:                                      ; No predecessors!

invertL14.i:                                      ; No predecessors!

invertL16.i:                                      ; No predecessors!

invertL25.i.preheader:                            ; No predecessors!

invertL25.i:                                      ; No predecessors!

invertL30.i:                                      ; No predecessors!

invertjulia_g_3108_inner.exit.loopexit:           ; No predecessors!

invertjulia_g_3108_inner.exit:                    ; preds = %julia_g_3108_inner.exit
  store double %differeturn, double* %"value_phi.i'de", align 8
}

; Function Attrs: willreturn mustprogress
define internal fastcc nonnull {} addrspace(10)* @preprocess_julia_deepcopy_3117({} addrspace(10)* nonnull align 16 dereferenceable(40) %0) unnamed_addr #10 !dbg !294 {
top:
  %1 = call {}*** @julia.get_pgcstack() #14
  %2 = call nonnull {} addrspace(10)* @jl_alloc_array_1d({} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 4693193712 to {}*) to {} addrspace(10)*), i64 noundef 32) #14, !dbg !295
  %ptls_field11 = getelementptr inbounds {}**, {}*** %1, i64 2305843009213693954, !dbg !296
  %3 = bitcast {}*** %ptls_field11 to i8**, !dbg !296
  %ptls_load1213 = load i8*, i8** %3, align 8, !dbg !296, !tbaa !108
  %4 = call noalias nonnull {} addrspace(10)* @julia.gc_alloc_obj(i8* %ptls_load1213, i64 noundef 24, {} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 4693590064 to {}*) to {} addrspace(10)*)) #16, !dbg !296
  %5 = bitcast {} addrspace(10)* %4 to {} addrspace(10)* addrspace(10)*, !dbg !296
  %6 = addrspacecast {} addrspace(10)* addrspace(10)* %5 to {} addrspace(10)* addrspace(11)*, !dbg !296
  store {} addrspace(10)* null, {} addrspace(10)* addrspace(11)* %6, align 8, !dbg !296, !tbaa !110
  store {} addrspace(10)* %2, {} addrspace(10)* addrspace(10)* %5, align 8, !dbg !296, !tbaa !110
  %7 = bitcast {} addrspace(10)* %4 to i8 addrspace(10)*, !dbg !296
  %8 = addrspacecast i8 addrspace(10)* %7 to i8 addrspace(11)*, !dbg !296
  %9 = getelementptr inbounds i8, i8 addrspace(11)* %8, i64 8, !dbg !296
  call void @llvm.memset.p11i8.i64(i8 addrspace(11)* align 8 dereferenceable(16) %9, i8 noundef 0, i64 noundef 16, i1 noundef false) #14, !dbg !296
  %10 = load atomic {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %6 unordered, align 8, !dbg !299, !tbaa !110, !nonnull !4, !dereferenceable !125, !align !126
  %11 = call nonnull {} addrspace(10)* @jl_eqtable_get({} addrspace(10)* nonnull %10, {} addrspace(10)* nonnull %0, {} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 4589640400 to {}*) to {} addrspace(10)*)) #14, !dbg !300
  %12 = addrspacecast {} addrspace(10)* %11 to {} addrspace(11)*, !dbg !304
  %.not = icmp eq {} addrspace(11)* %12, addrspacecast ({}* inttoptr (i64 4589640400 to {}*) to {} addrspace(11)*), !dbg !304
  br i1 %.not, label %L29, label %L17, !dbg !303

L17:                                              ; preds = %top
  %13 = call nonnull {} addrspace(10)* @jl_eqtable_get({} addrspace(10)* nonnull %10, {} addrspace(10)* nonnull %0, {} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 4589640400 to {}*) to {} addrspace(10)*)) #14, !dbg !305
  %14 = addrspacecast {} addrspace(10)* %13 to {} addrspace(11)*, !dbg !307
  %.not14 = icmp eq {} addrspace(11)* %14, addrspacecast ({}* inttoptr (i64 4589640400 to {}*) to {} addrspace(11)*), !dbg !307
  br i1 %.not14, label %L21, label %L26, !dbg !307

L21:                                              ; preds = %L17
  %ptls_load41718 = load i8*, i8** %3, align 8, !dbg !307, !tbaa !108
  %15 = call noalias nonnull {} addrspace(10)* @julia.gc_alloc_obj(i8* %ptls_load41718, i64 noundef 8, {} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 4745749536 to {}*) to {} addrspace(10)*)) #16, !dbg !307
  %16 = bitcast {} addrspace(10)* %15 to {} addrspace(10)* addrspace(10)*, !dbg !307
  store {} addrspace(10)* %0, {} addrspace(10)* addrspace(10)* %16, align 8, !dbg !307, !tbaa !132
  %17 = addrspacecast {} addrspace(10)* %15 to {} addrspace(12)*, !dbg !307
  call void @jl_throw({} addrspace(12)* %17) #17, !dbg !307
  unreachable, !dbg !307

L26:                                              ; preds = %L17
  %18 = call {} addrspace(10)* @julia.typeof({} addrspace(10)* nonnull %13) #18, !dbg !306
  %19 = icmp eq {} addrspace(10)* %18, addrspacecast ({}* inttoptr (i64 4701817328 to {}*) to {} addrspace(10)*), !dbg !306
  br i1 %19, label %L32, label %fail, !dbg !306

L29:                                              ; preds = %top
  %20 = call nonnull {} addrspace(10)* @jl_array_copy({} addrspace(10)* nonnull %0) #14, !dbg !308
  %21 = call cc38 nonnull {} addrspace(10)* bitcast ({} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)**, i32, {} addrspace(10)*)* @jl_invoke to {} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*)*)({} addrspace(10)* addrspacecast ({}* inttoptr (i64 4699896688 to {}*) to {} addrspace(10)*), {} addrspace(10)* addrspacecast ({}* inttoptr (i64 4752928528 to {}*) to {} addrspace(10)*), {} addrspace(10)* nonnull %4, {} addrspace(10)* nonnull %20, {} addrspace(10)* nonnull %0) #14, !dbg !309
  br label %L32, !dbg !310

L32:                                              ; preds = %L29, %L26
  %value_phi5 = phi {} addrspace(10)* [ %20, %L29 ], [ %13, %L26 ]
  ret {} addrspace(10)* %value_phi5, !dbg !298

fail:                                             ; preds = %L26
  %22 = addrspacecast {} addrspace(10)* %13 to {} addrspace(12)*, !dbg !306
  call void @jl_type_error(i8* noundef getelementptr inbounds ([11 x i8], [11 x i8]* @_j_str1, i64 0, i64 0), {} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 4701817328 to {}*) to {} addrspace(10)*), {} addrspace(12)* %22) #17, !dbg !306
  unreachable, !dbg !306
}

; Function Attrs: willreturn mustprogress
define internal fastcc nonnull { i8*, {} addrspace(10)*, {} addrspace(10)* } @fakeaugmented_julia_deepcopy_3117({} addrspace(10)* nonnull align 16 dereferenceable(40) %0, {} addrspace(10)* %"'") unnamed_addr #10 !dbg !311 {
top:
  %1 = call {}*** @julia.get_pgcstack() #14
  %2 = call nonnull {} addrspace(10)* @jl_alloc_array_1d({} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 4693193712 to {}*) to {} addrspace(10)*), i64 noundef 32) #14, !dbg !312
  %"'mi" = phi {} addrspace(10)* , !dbg !313
  %ptls_field11 = getelementptr inbounds {}**, {}*** %1, i64 2305843009213693954, !dbg !313
  %3 = bitcast {}*** %ptls_field11 to i8**, !dbg !313
  %ptls_load1213 = load i8*, i8** %3, align 8, !dbg !313, !tbaa !108
  %"ptls_load1213'il_phi" = phi i8* , !dbg !313
  %4 = call noalias nonnull {} addrspace(10)* @julia.gc_alloc_obj(i8* %ptls_load1213, i64 noundef 24, {} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 4693590064 to {}*) to {} addrspace(10)*)) #16, !dbg !313
  %"'mi1" = phi {} addrspace(10)* , !dbg !313
  %5 = bitcast {} addrspace(10)* %4 to {} addrspace(10)* addrspace(10)*, !dbg !313
  %6 = addrspacecast {} addrspace(10)* addrspace(10)* %5 to {} addrspace(10)* addrspace(11)*, !dbg !313
  store {} addrspace(10)* null, {} addrspace(10)* addrspace(11)* %6, align 8, !dbg !313, !tbaa !110
  store {} addrspace(10)* %2, {} addrspace(10)* addrspace(10)* %5, align 8, !dbg !313, !tbaa !110
  %7 = bitcast {} addrspace(10)* %4 to i8 addrspace(10)*, !dbg !313
  %8 = addrspacecast i8 addrspace(10)* %7 to i8 addrspace(11)*, !dbg !313
  %9 = getelementptr inbounds i8, i8 addrspace(11)* %8, i64 8, !dbg !313
  call void @llvm.memset.p11i8.i64(i8 addrspace(11)* align 8 dereferenceable(16) %9, i8 noundef 0, i64 noundef 16, i1 noundef false) #14, !dbg !313
  %10 = load atomic {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %6 unordered, align 8, !dbg !316, !tbaa !110, !nonnull !4, !dereferenceable !125, !align !126
  %"'il_phi" = phi {} addrspace(10)* , !dbg !317
  %11 = call nonnull {} addrspace(10)* @jl_eqtable_get({} addrspace(10)* nonnull %10, {} addrspace(10)* nonnull %0, {} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 4589640400 to {}*) to {} addrspace(10)*)) #14, !dbg !317
  %12 = addrspacecast {} addrspace(10)* %11 to {} addrspace(11)*, !dbg !321
  %.not = icmp eq {} addrspace(11)* %12, addrspacecast ({}* inttoptr (i64 4589640400 to {}*) to {} addrspace(11)*), !dbg !321
  br i1 %.not, label %L29, label %L17, !dbg !320

L17:                                              ; preds = %top
  %13 = call nonnull {} addrspace(10)* @jl_eqtable_get({} addrspace(10)* nonnull %10, {} addrspace(10)* nonnull %0, {} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 4589640400 to {}*) to {} addrspace(10)*)) #14, !dbg !322
  %"'ip_phi" = phi {} addrspace(10)* , !dbg !324
  %14 = addrspacecast {} addrspace(10)* %13 to {} addrspace(11)*, !dbg !324
  %.not14 = icmp eq {} addrspace(11)* %14, addrspacecast ({}* inttoptr (i64 4589640400 to {}*) to {} addrspace(11)*), !dbg !324
  br i1 %.not14, label %L21, label %L26, !dbg !324

L21:                                              ; preds = %L17
  %ptls_load41718 = load i8*, i8** %3, align 8, !dbg !324, !tbaa !108
  %15 = call noalias nonnull {} addrspace(10)* @julia.gc_alloc_obj(i8* %ptls_load41718, i64 noundef 8, {} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 4745749536 to {}*) to {} addrspace(10)*)) #16, !dbg !324
  %16 = bitcast {} addrspace(10)* %15 to {} addrspace(10)* addrspace(10)*, !dbg !324
  store {} addrspace(10)* %0, {} addrspace(10)* addrspace(10)* %16, align 8, !dbg !324, !tbaa !132
  %17 = addrspacecast {} addrspace(10)* %15 to {} addrspace(12)*, !dbg !324
  call void @jl_throw({} addrspace(12)* %17) #17, !dbg !324
  unreachable, !dbg !324

L26:                                              ; preds = %L17
  %18 = call {} addrspace(10)* @julia.typeof({} addrspace(10)* nonnull %13) #18, !dbg !323
  %19 = icmp eq {} addrspace(10)* %18, addrspacecast ({}* inttoptr (i64 4701817328 to {}*) to {} addrspace(10)*), !dbg !323
  br i1 %19, label %L32, label %fail, !dbg !323

L29:                                              ; preds = %top
  %20 = call nonnull {} addrspace(10)* @jl_array_copy({} addrspace(10)* nonnull %0) #14, !dbg !325
  %"'ip_phi2" = phi {} addrspace(10)* , !dbg !326
  %21 = call cc38 nonnull {} addrspace(10)* bitcast ({} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)**, i32, {} addrspace(10)*)* @jl_invoke to {} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*)*)({} addrspace(10)* addrspacecast ({}* inttoptr (i64 4699896688 to {}*) to {} addrspace(10)*), {} addrspace(10)* addrspacecast ({}* inttoptr (i64 4752928528 to {}*) to {} addrspace(10)*), {} addrspace(10)* nonnull %4, {} addrspace(10)* nonnull %20, {} addrspace(10)* nonnull %0) #14, !dbg !326
  br label %L32, !dbg !327

L32:                                              ; preds = %L29, %L26
  %value_phi5 = phi {} addrspace(10)* [ %20, %L29 ], [ %13, %L26 ]
  %22 = insertvalue { i8*, {} addrspace(10)*, {} addrspace(10)* } undef, {} addrspace(10)* %value_phi5, 1, !dbg !315
  ret { i8*, {} addrspace(10)*, {} addrspace(10)* } %22, !dbg !315

fail:                                             ; preds = %L26
  %23 = addrspacecast {} addrspace(10)* %13 to {} addrspace(12)*, !dbg !323
  call void @jl_type_error(i8* noundef getelementptr inbounds ([11 x i8], [11 x i8]* @_j_str1, i64 0, i64 0), {} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 4701817328 to {}*) to {} addrspace(10)*), {} addrspace(12)* %23) #17, !dbg !323
  unreachable, !dbg !323

allocsForInversion:                               ; No predecessors!
}

attributes #0 = { readnone "enzyme_inactive" }
attributes #1 = { inaccessiblememonly allocsize(1) }
attributes #2 = { noreturn }
attributes #3 = { noinline nosync readonly "probe-stack"="inline-asm" }
attributes #4 = { "probe-stack"="inline-asm" }
attributes #5 = { norecurse nounwind readnone "enzyme_inactive" "enzyme_shouldrecompute" }
attributes #6 = { inaccessiblemem_or_argmemonly }
attributes #7 = { inaccessiblememonly }
attributes #8 = { argmemonly nofree nosync nounwind willreturn }
attributes #9 = { argmemonly nofree nosync nounwind willreturn writeonly }
attributes #10 = { willreturn mustprogress "probe-stack"="inline-asm" }
attributes #11 = { allocsize(1) }
attributes #12 = { nounwind readnone }
attributes #13 = { readonly "probe-stack"="inline-asm" }
attributes #14 = { willreturn mustprogress }
attributes #15 = { readonly willreturn mustprogress "probe-stack"="inline-asm" }
attributes #16 = { willreturn mustprogress allocsize(1) }
attributes #17 = { noreturn willreturn mustprogress }
attributes #18 = { nounwind readnone willreturn mustprogress }

!llvm.module.flags = !{!0, !1}
!llvm.dbg.cu = !{!2, !5, !7, !9}

!0 = !{i32 2, !"Dwarf Version", i32 4}
!1 = !{i32 2, !"Debug Info Version", i32 3}
!2 = distinct !DICompileUnit(language: DW_LANG_Julia, file: !3, producer: "julia", isOptimized: true, runtimeVersion: 0, emissionKind: LineTablesOnly, enums: !4, nameTableKind: None)
!3 = !DIFile(filename: "REPL[31]", directory: ".")
!4 = !{}
!5 = distinct !DICompileUnit(language: DW_LANG_Julia, file: !6, producer: "julia", isOptimized: true, runtimeVersion: 0, emissionKind: LineTablesOnly, enums: !4, nameTableKind: None)
!6 = !DIFile(filename: "abstractarray.jl", directory: ".")
!7 = distinct !DICompileUnit(language: DW_LANG_Julia, file: !8, producer: "julia", isOptimized: true, runtimeVersion: 0, emissionKind: LineTablesOnly, enums: !4, nameTableKind: None)
!8 = !DIFile(filename: "reduce.jl", directory: ".")
!9 = distinct !DICompileUnit(language: DW_LANG_Julia, file: !10, producer: "julia", isOptimized: true, runtimeVersion: 0, emissionKind: LineTablesOnly, enums: !4, nameTableKind: None)
!10 = !DIFile(filename: "deepcopy.jl", directory: ".")
!11 = distinct !DISubprogram(name: "mapreduce_impl", linkageName: "julia_mapreduce_impl_3112", scope: null, file: !8, line: 235, type: !12, scopeLine: 235, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !7, retainedNodes: !4)
!12 = !DISubroutineType(types: !4)
!13 = !DILocation(line: 468, scope: !14, inlinedAt: !16)
!14 = distinct !DISubprogram(name: "==;", linkageName: "==", scope: !15, file: !15, type: !12, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !7, retainedNodes: !4)
!15 = !DIFile(filename: "promotion.jl", directory: ".")
!16 = !DILocation(line: 237, scope: !11)
!17 = !DILocation(line: 861, scope: !18, inlinedAt: !20)
!18 = distinct !DISubprogram(name: "getindex;", linkageName: "getindex", scope: !19, file: !19, type: !12, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !7, retainedNodes: !4)
!19 = !DIFile(filename: "array.jl", directory: ".")
!20 = !DILocation(line: 238, scope: !11)
!21 = !{!22, !22, i64 0}
!22 = !{!"jtbaa_arrayptr", !23, i64 0}
!23 = !{!"jtbaa_array", !24, i64 0}
!24 = !{!"jtbaa", !25, i64 0}
!25 = !{!"jtbaa"}
!26 = !{!27, !27, i64 0}
!27 = !{!"jtbaa_arraybuf", !28, i64 0}
!28 = !{!"jtbaa_data", !24, i64 0}
!29 = !DILocation(line: 239, scope: !11)
!30 = !DILocation(line: 86, scope: !31, inlinedAt: !33)
!31 = distinct !DISubprogram(name: "-;", linkageName: "-", scope: !32, file: !32, type: !12, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !7, retainedNodes: !4)
!32 = !DIFile(filename: "int.jl", directory: ".")
!33 = !DILocation(line: 240, scope: !11)
!34 = !DILocation(line: 83, scope: !35, inlinedAt: !33)
!35 = distinct !DISubprogram(name: "<;", linkageName: "<", scope: !32, file: !32, type: !12, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !7, retainedNodes: !4)
!36 = !DILocation(line: 861, scope: !18, inlinedAt: !37)
!37 = !DILocation(line: 242, scope: !11)
!38 = !DILocation(line: 861, scope: !18, inlinedAt: !39)
!39 = !DILocation(line: 243, scope: !11)
!40 = !DILocation(line: 399, scope: !41, inlinedAt: !43)
!41 = distinct !DISubprogram(name: "+;", linkageName: "+", scope: !42, file: !42, type: !12, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !7, retainedNodes: !4)
!42 = !DIFile(filename: "float.jl", directory: ".")
!43 = !DILocation(line: 27, scope: !44, inlinedAt: !45)
!44 = distinct !DISubprogram(name: "add_sum;", linkageName: "add_sum", scope: !8, file: !8, type: !12, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !7, retainedNodes: !4)
!45 = !DILocation(line: 244, scope: !11)
!46 = !DILocation(line: 87, scope: !47, inlinedAt: !48)
!47 = distinct !DISubprogram(name: "+;", linkageName: "+", scope: !32, file: !32, type: !12, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !7, retainedNodes: !4)
!48 = !DILocation(line: 69, scope: !49, inlinedAt: !51)
!49 = distinct !DISubprogram(name: "macro expansion;", linkageName: "macro expansion", scope: !50, file: !50, type: !12, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !7, retainedNodes: !4)
!50 = !DIFile(filename: "simdloop.jl", directory: ".")
!51 = !DILocation(line: 245, scope: !11)
!52 = !DILocation(line: 477, scope: !53, inlinedAt: !54)
!53 = distinct !DISubprogram(name: "<=;", linkageName: "<=", scope: !32, file: !32, type: !12, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !7, retainedNodes: !4)
!54 = !DILocation(line: 425, scope: !55, inlinedAt: !57)
!55 = distinct !DISubprogram(name: ">=;", linkageName: ">=", scope: !56, file: !56, type: !12, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !7, retainedNodes: !4)
!56 = !DIFile(filename: "operators.jl", directory: ".")
!57 = !DILocation(line: 359, scope: !58, inlinedAt: !60)
!58 = distinct !DISubprogram(name: "unitrange_last;", linkageName: "unitrange_last", scope: !59, file: !59, type: !12, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !7, retainedNodes: !4)
!59 = !DIFile(filename: "range.jl", directory: ".")
!60 = !DILocation(line: 354, scope: !61, inlinedAt: !62)
!61 = distinct !DISubprogram(name: "UnitRange;", linkageName: "UnitRange", scope: !59, file: !59, type: !12, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !7, retainedNodes: !4)
!62 = !DILocation(line: 5, scope: !63, inlinedAt: !48)
!63 = distinct !DISubprogram(name: "Colon;", linkageName: "Colon", scope: !59, file: !59, type: !12, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !7, retainedNodes: !4)
!64 = !DILocation(line: 86, scope: !31, inlinedAt: !57)
!65 = !DILocation(line: 86, scope: !31, inlinedAt: !66)
!66 = !DILocation(line: 699, scope: !67, inlinedAt: !68)
!67 = distinct !DISubprogram(name: "length;", linkageName: "length", scope: !59, file: !59, type: !12, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !7, retainedNodes: !4)
!68 = !DILocation(line: 51, scope: !69, inlinedAt: !70)
!69 = distinct !DISubprogram(name: "simd_inner_length;", linkageName: "simd_inner_length", scope: !50, file: !50, type: !12, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !7, retainedNodes: !4)
!70 = !DILocation(line: 71, scope: !49, inlinedAt: !51)
!71 = !DILocation(line: 87, scope: !47, inlinedAt: !72)
!72 = !DILocation(line: 700, scope: !67, inlinedAt: !68)
!73 = !DILocation(line: 83, scope: !35, inlinedAt: !74)
!74 = !DILocation(line: 72, scope: !49, inlinedAt: !51)
!75 = !DILocation(line: 861, scope: !18, inlinedAt: !76)
!76 = !DILocation(line: 246, scope: !77, inlinedAt: !78)
!77 = distinct !DISubprogram(name: "macro expansion;", linkageName: "macro expansion", scope: !8, file: !8, type: !12, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !7, retainedNodes: !4)
!78 = !DILocation(line: 77, scope: !49, inlinedAt: !51)
!79 = !DILocation(line: 399, scope: !41, inlinedAt: !80)
!80 = !DILocation(line: 27, scope: !44, inlinedAt: !81)
!81 = !DILocation(line: 247, scope: !77, inlinedAt: !78)
!82 = !DILocation(line: 87, scope: !47, inlinedAt: !83)
!83 = !DILocation(line: 78, scope: !49, inlinedAt: !51)
!84 = !DILocation(line: 83, scope: !35, inlinedAt: !85)
!85 = !DILocation(line: 75, scope: !49, inlinedAt: !51)
!86 = distinct !{!86}
!87 = !DILocation(line: 249, scope: !11)
!88 = !DILocation(line: 490, scope: !89, inlinedAt: !90)
!89 = distinct !DISubprogram(name: ">>;", linkageName: ">>", scope: !32, file: !32, type: !12, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !7, retainedNodes: !4)
!90 = !DILocation(line: 497, scope: !89, inlinedAt: !91)
!91 = !DILocation(line: 252, scope: !11)
!92 = !DILocation(line: 87, scope: !47, inlinedAt: !91)
!93 = !DILocation(line: 253, scope: !11)
!94 = !DILocation(line: 87, scope: !47, inlinedAt: !95)
!95 = !DILocation(line: 254, scope: !11)
!96 = !DILocation(line: 399, scope: !41, inlinedAt: !97)
!97 = !DILocation(line: 27, scope: !44, inlinedAt: !98)
!98 = !DILocation(line: 255, scope: !11)
!99 = distinct !DISubprogram(name: "deepcopy", linkageName: "julia_deepcopy_3117", scope: null, file: !10, line: 24, type: !12, scopeLine: 24, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !9, retainedNodes: !4)
!100 = !DILocation(line: 457, scope: !101, inlinedAt: !103)
!101 = distinct !DISubprogram(name: "Array;", linkageName: "Array", scope: !102, file: !102, type: !12, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !9, retainedNodes: !4)
!102 = !DIFile(filename: "boot.jl", directory: ".")
!103 = !DILocation(line: 30, scope: !104, inlinedAt: !106)
!104 = distinct !DISubprogram(name: "IdDict;", linkageName: "IdDict", scope: !105, file: !105, type: !12, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !9, retainedNodes: !4)
!105 = !DIFile(filename: "iddict.jl", directory: ".")
!106 = !DILocation(line: 48, scope: !104, inlinedAt: !107)
!107 = !DILocation(line: 26, scope: !99)
!108 = !{!109, !109, i64 0}
!109 = !{!"jtbaa_gcframe", !24, i64 0}
!110 = !{!111, !111, i64 0}
!111 = !{!"jtbaa_mutab", !112, i64 0}
!112 = !{!"jtbaa_value", !28, i64 0}
!113 = !DILocation(line: 42, scope: !114, inlinedAt: !116)
!114 = distinct !DISubprogram(name: "getproperty;", linkageName: "getproperty", scope: !115, file: !115, type: !12, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !9, retainedNodes: !4)
!115 = !DIFile(filename: "Base.jl", directory: ".")
!116 = !DILocation(line: 102, scope: !117, inlinedAt: !118)
!117 = distinct !DISubprogram(name: "get;", linkageName: "get", scope: !105, file: !105, type: !12, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !9, retainedNodes: !4)
!118 = !DILocation(line: 189, scope: !119, inlinedAt: !120)
!119 = distinct !DISubprogram(name: "in;", linkageName: "in", scope: !105, file: !105, type: !12, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !9, retainedNodes: !4)
!120 = !DILocation(line: 17, scope: !121, inlinedAt: !123)
!121 = distinct !DISubprogram(name: "haskey;", linkageName: "haskey", scope: !122, file: !122, type: !12, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !9, retainedNodes: !4)
!122 = !DIFile(filename: "abstractdict.jl", directory: ".")
!123 = !DILocation(line: 89, scope: !124, inlinedAt: !107)
!124 = distinct !DISubprogram(name: "deepcopy_internal;", linkageName: "deepcopy_internal", scope: !10, file: !10, type: !12, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !9, retainedNodes: !4)
!125 = !{i64 40}
!126 = !{i64 16}
!127 = !DILocation(line: 103, scope: !117, inlinedAt: !118)
!128 = !DILocation(line: 107, scope: !129, inlinedAt: !130)
!129 = distinct !DISubprogram(name: "getindex;", linkageName: "getindex", scope: !105, file: !105, type: !12, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !9, retainedNodes: !4)
!130 = !DILocation(line: 90, scope: !124, inlinedAt: !107)
!131 = !DILocation(line: 108, scope: !129, inlinedAt: !130)
!132 = !{!133, !133, i64 0}
!133 = !{!"jtbaa_immut", !112, i64 0}
!134 = !DILocation(line: 369, scope: !135, inlinedAt: !136)
!135 = distinct !DISubprogram(name: "copy;", linkageName: "copy", scope: !19, file: !19, type: !12, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !9, retainedNodes: !4)
!136 = !DILocation(line: 97, scope: !137, inlinedAt: !138)
!137 = distinct !DISubprogram(name: "_deepcopy_array_t;", linkageName: "_deepcopy_array_t", scope: !10, file: !10, type: !12, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !9, retainedNodes: !4)
!138 = !DILocation(line: 92, scope: !124, inlinedAt: !107)
!139 = distinct !DISubprogram(name: "g", linkageName: "julia_g_3108", scope: null, file: !3, line: 1, type: !12, scopeLine: 1, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !4)
!140 = !DILocation(line: 1, scope: !139, inlinedAt: !141)
!141 = distinct !DILocation(line: 0, scope: !139)
!142 = !DILocation(line: 151, scope: !143, inlinedAt: !144)
!143 = distinct !DISubprogram(name: "size;", linkageName: "size", scope: !19, file: !19, type: !12, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !4)
!144 = distinct !DILocation(line: 95, scope: !145, inlinedAt: !146)
!145 = distinct !DISubprogram(name: "axes;", linkageName: "axes", scope: !6, file: !6, type: !12, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !4)
!146 = distinct !DILocation(line: 457, scope: !147, inlinedAt: !149)
!147 = distinct !DISubprogram(name: "LinearIndices;", linkageName: "LinearIndices", scope: !148, file: !148, type: !12, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !4)
!148 = !DIFile(filename: "indices.jl", directory: ".")
!149 = distinct !DILocation(line: 399, scope: !150, inlinedAt: !151)
!150 = distinct !DISubprogram(name: "_mapreduce;", linkageName: "_mapreduce", scope: !8, file: !8, type: !12, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !4)
!151 = distinct !DILocation(line: 330, scope: !152, inlinedAt: !154)
!152 = distinct !DISubprogram(name: "_mapreduce_dim;", linkageName: "_mapreduce_dim", scope: !153, file: !153, type: !12, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !4)
!153 = !DIFile(filename: "reducedim.jl", directory: ".")
!154 = distinct !DILocation(line: 322, scope: !155, inlinedAt: !156)
!155 = distinct !DISubprogram(name: "#mapreduce#731;", linkageName: "#mapreduce#731", scope: !153, file: !153, type: !12, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !4)
!156 = distinct !DILocation(line: 322, scope: !157, inlinedAt: !158)
!157 = distinct !DISubprogram(name: "mapreduce;", linkageName: "mapreduce", scope: !153, file: !153, type: !12, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !4)
!158 = distinct !DILocation(line: 894, scope: !159, inlinedAt: !160)
!159 = distinct !DISubprogram(name: "#_sum#741;", linkageName: "#_sum#741", scope: !153, file: !153, type: !12, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !4)
!160 = distinct !DILocation(line: 894, scope: !161, inlinedAt: !162)
!161 = distinct !DISubprogram(name: "_sum;", linkageName: "_sum", scope: !153, file: !153, type: !12, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !4)
!162 = distinct !DILocation(line: 893, scope: !163, inlinedAt: !164)
!163 = distinct !DISubprogram(name: "#_sum#740;", linkageName: "#_sum#740", scope: !153, file: !153, type: !12, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !4)
!164 = distinct !DILocation(line: 893, scope: !161, inlinedAt: !165)
!165 = distinct !DILocation(line: 889, scope: !166, inlinedAt: !167)
!166 = distinct !DISubprogram(name: "#sum#738;", linkageName: "#sum#738", scope: !153, file: !153, type: !12, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !4)
!167 = distinct !DILocation(line: 889, scope: !168, inlinedAt: !169)
!168 = distinct !DISubprogram(name: "sum;", linkageName: "sum", scope: !153, file: !153, type: !12, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !4)
!169 = distinct !DILocation(line: 1, scope: !139, inlinedAt: !141)
!170 = !{!171, !171, i64 0}
!171 = !{!"jtbaa_arraysize", !23, i64 0}
!172 = !{i64 0, i64 9223372036854775807}
!173 = !DILocation(line: 401, scope: !150, inlinedAt: !151)
!174 = !DILocation(line: 861, scope: !175, inlinedAt: !176)
!175 = distinct !DISubprogram(name: "getindex;", linkageName: "getindex", scope: !19, file: !19, type: !12, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !4)
!176 = distinct !DILocation(line: 404, scope: !150, inlinedAt: !151)
!177 = !DILocation(line: 405, scope: !150, inlinedAt: !151)
!178 = !DILocation(line: 83, scope: !179, inlinedAt: !180)
!179 = distinct !DISubprogram(name: "<;", linkageName: "<", scope: !32, file: !32, type: !12, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !4)
!180 = distinct !DILocation(line: 406, scope: !150, inlinedAt: !151)
!181 = !DILocation(line: 406, scope: !150, inlinedAt: !151)
!182 = !DILocation(line: 861, scope: !175, inlinedAt: !183)
!183 = distinct !DILocation(line: 408, scope: !150, inlinedAt: !151)
!184 = !DILocation(line: 861, scope: !175, inlinedAt: !185)
!185 = distinct !DILocation(line: 409, scope: !150, inlinedAt: !151)
!186 = !DILocation(line: 399, scope: !187, inlinedAt: !188)
!187 = distinct !DISubprogram(name: "+;", linkageName: "+", scope: !42, file: !42, type: !12, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !4)
!188 = distinct !DILocation(line: 27, scope: !189, inlinedAt: !190)
!189 = distinct !DISubprogram(name: "add_sum;", linkageName: "add_sum", scope: !8, file: !8, type: !12, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !4)
!190 = distinct !DILocation(line: 410, scope: !150, inlinedAt: !151)
!191 = !DILocation(line: 83, scope: !179, inlinedAt: !192)
!192 = distinct !DILocation(line: 411, scope: !150, inlinedAt: !151)
!193 = !DILocation(line: 411, scope: !150, inlinedAt: !151)
!194 = !DILocation(line: 87, scope: !195, inlinedAt: !196)
!195 = distinct !DISubprogram(name: "+;", linkageName: "+", scope: !32, file: !32, type: !12, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !4)
!196 = distinct !DILocation(line: 412, scope: !150, inlinedAt: !151)
!197 = !DILocation(line: 861, scope: !175, inlinedAt: !196)
!198 = !DILocation(line: 399, scope: !187, inlinedAt: !199)
!199 = distinct !DILocation(line: 27, scope: !189, inlinedAt: !200)
!200 = distinct !DILocation(line: 413, scope: !150, inlinedAt: !151)
!201 = !DILocation(line: 259, scope: !202, inlinedAt: !203)
!202 = distinct !DISubprogram(name: "mapreduce_impl;", linkageName: "mapreduce_impl", scope: !8, file: !8, type: !12, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !4)
!203 = distinct !DILocation(line: 417, scope: !150, inlinedAt: !151)
!204 = !DILocation(line: 417, scope: !150, inlinedAt: !151)
!205 = !DILocation(line: 0, scope: !139)
!206 = distinct !DISubprogram(name: "g", linkageName: "julia_g_3108", scope: null, file: !3, line: 1, type: !12, scopeLine: 1, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !4)
!207 = !DILocation(line: 1, scope: !206, inlinedAt: !208)
!208 = distinct !DILocation(line: 0, scope: !206)
!209 = !DILocation(line: 151, scope: !143, inlinedAt: !210)
!210 = distinct !DILocation(line: 95, scope: !145, inlinedAt: !211)
!211 = distinct !DILocation(line: 457, scope: !147, inlinedAt: !212)
!212 = distinct !DILocation(line: 399, scope: !150, inlinedAt: !213)
!213 = distinct !DILocation(line: 330, scope: !152, inlinedAt: !214)
!214 = distinct !DILocation(line: 322, scope: !155, inlinedAt: !215)
!215 = distinct !DILocation(line: 322, scope: !157, inlinedAt: !216)
!216 = distinct !DILocation(line: 894, scope: !159, inlinedAt: !217)
!217 = distinct !DILocation(line: 894, scope: !161, inlinedAt: !218)
!218 = distinct !DILocation(line: 893, scope: !163, inlinedAt: !219)
!219 = distinct !DILocation(line: 893, scope: !161, inlinedAt: !220)
!220 = distinct !DILocation(line: 889, scope: !166, inlinedAt: !221)
!221 = distinct !DILocation(line: 889, scope: !168, inlinedAt: !222)
!222 = distinct !DILocation(line: 1, scope: !206, inlinedAt: !208)
!223 = !DILocation(line: 401, scope: !150, inlinedAt: !213)
!224 = !DILocation(line: 861, scope: !175, inlinedAt: !225)
!225 = distinct !DILocation(line: 404, scope: !150, inlinedAt: !213)
!226 = !DILocation(line: 405, scope: !150, inlinedAt: !213)
!227 = !DILocation(line: 83, scope: !179, inlinedAt: !228)
!228 = distinct !DILocation(line: 406, scope: !150, inlinedAt: !213)
!229 = !DILocation(line: 406, scope: !150, inlinedAt: !213)
!230 = !DILocation(line: 861, scope: !175, inlinedAt: !231)
!231 = distinct !DILocation(line: 408, scope: !150, inlinedAt: !213)
!232 = !DILocation(line: 861, scope: !175, inlinedAt: !233)
!233 = distinct !DILocation(line: 409, scope: !150, inlinedAt: !213)
!234 = !DILocation(line: 399, scope: !187, inlinedAt: !235)
!235 = distinct !DILocation(line: 27, scope: !189, inlinedAt: !236)
!236 = distinct !DILocation(line: 410, scope: !150, inlinedAt: !213)
!237 = !DILocation(line: 83, scope: !179, inlinedAt: !238)
!238 = distinct !DILocation(line: 411, scope: !150, inlinedAt: !213)
!239 = !DILocation(line: 411, scope: !150, inlinedAt: !213)
!240 = !DILocation(line: 87, scope: !195, inlinedAt: !241)
!241 = distinct !DILocation(line: 412, scope: !150, inlinedAt: !213)
!242 = !DILocation(line: 861, scope: !175, inlinedAt: !241)
!243 = !DILocation(line: 399, scope: !187, inlinedAt: !244)
!244 = distinct !DILocation(line: 27, scope: !189, inlinedAt: !245)
!245 = distinct !DILocation(line: 413, scope: !150, inlinedAt: !213)
!246 = !DILocation(line: 259, scope: !202, inlinedAt: !247)
!247 = distinct !DILocation(line: 417, scope: !150, inlinedAt: !213)
!248 = !DILocation(line: 417, scope: !150, inlinedAt: !213)
!249 = !DILocation(line: 0, scope: !206)
!250 = distinct !DISubprogram(name: "g", linkageName: "julia_g_3108", scope: null, file: !3, line: 1, type: !12, scopeLine: 1, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !4)
!251 = !DILocation(line: 1, scope: !250, inlinedAt: !252)
!252 = distinct !DILocation(line: 0, scope: !250)
!253 = !DILocation(line: 151, scope: !143, inlinedAt: !254)
!254 = distinct !DILocation(line: 95, scope: !145, inlinedAt: !255)
!255 = distinct !DILocation(line: 457, scope: !147, inlinedAt: !256)
!256 = distinct !DILocation(line: 399, scope: !150, inlinedAt: !257)
!257 = distinct !DILocation(line: 330, scope: !152, inlinedAt: !258)
!258 = distinct !DILocation(line: 322, scope: !155, inlinedAt: !259)
!259 = distinct !DILocation(line: 322, scope: !157, inlinedAt: !260)
!260 = distinct !DILocation(line: 894, scope: !159, inlinedAt: !261)
!261 = distinct !DILocation(line: 894, scope: !161, inlinedAt: !262)
!262 = distinct !DILocation(line: 893, scope: !163, inlinedAt: !263)
!263 = distinct !DILocation(line: 893, scope: !161, inlinedAt: !264)
!264 = distinct !DILocation(line: 889, scope: !166, inlinedAt: !265)
!265 = distinct !DILocation(line: 889, scope: !168, inlinedAt: !266)
!266 = distinct !DILocation(line: 1, scope: !250, inlinedAt: !252)
!267 = !DILocation(line: 401, scope: !150, inlinedAt: !257)
!268 = !DILocation(line: 861, scope: !175, inlinedAt: !269)
!269 = distinct !DILocation(line: 404, scope: !150, inlinedAt: !257)
!270 = !DILocation(line: 405, scope: !150, inlinedAt: !257)
!271 = !DILocation(line: 83, scope: !179, inlinedAt: !272)
!272 = distinct !DILocation(line: 406, scope: !150, inlinedAt: !257)
!273 = !DILocation(line: 406, scope: !150, inlinedAt: !257)
!274 = !DILocation(line: 861, scope: !175, inlinedAt: !275)
!275 = distinct !DILocation(line: 408, scope: !150, inlinedAt: !257)
!276 = !DILocation(line: 861, scope: !175, inlinedAt: !277)
!277 = distinct !DILocation(line: 409, scope: !150, inlinedAt: !257)
!278 = !DILocation(line: 399, scope: !187, inlinedAt: !279)
!279 = distinct !DILocation(line: 27, scope: !189, inlinedAt: !280)
!280 = distinct !DILocation(line: 410, scope: !150, inlinedAt: !257)
!281 = !DILocation(line: 83, scope: !179, inlinedAt: !282)
!282 = distinct !DILocation(line: 411, scope: !150, inlinedAt: !257)
!283 = !DILocation(line: 411, scope: !150, inlinedAt: !257)
!284 = !DILocation(line: 87, scope: !195, inlinedAt: !285)
!285 = distinct !DILocation(line: 412, scope: !150, inlinedAt: !257)
!286 = !DILocation(line: 861, scope: !175, inlinedAt: !285)
!287 = !DILocation(line: 399, scope: !187, inlinedAt: !288)
!288 = distinct !DILocation(line: 27, scope: !189, inlinedAt: !289)
!289 = distinct !DILocation(line: 413, scope: !150, inlinedAt: !257)
!290 = !DILocation(line: 259, scope: !202, inlinedAt: !291)
!291 = distinct !DILocation(line: 417, scope: !150, inlinedAt: !257)
!292 = !DILocation(line: 417, scope: !150, inlinedAt: !257)
!293 = !DILocation(line: 0, scope: !250)
!294 = distinct !DISubprogram(name: "deepcopy", linkageName: "julia_deepcopy_3117", scope: null, file: !10, line: 24, type: !12, scopeLine: 24, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !9, retainedNodes: !4)
!295 = !DILocation(line: 457, scope: !101, inlinedAt: !296)
!296 = !DILocation(line: 30, scope: !104, inlinedAt: !297)
!297 = !DILocation(line: 48, scope: !104, inlinedAt: !298)
!298 = !DILocation(line: 26, scope: !294)
!299 = !DILocation(line: 42, scope: !114, inlinedAt: !300)
!300 = !DILocation(line: 102, scope: !117, inlinedAt: !301)
!301 = !DILocation(line: 189, scope: !119, inlinedAt: !302)
!302 = !DILocation(line: 17, scope: !121, inlinedAt: !303)
!303 = !DILocation(line: 89, scope: !124, inlinedAt: !298)
!304 = !DILocation(line: 103, scope: !117, inlinedAt: !301)
!305 = !DILocation(line: 107, scope: !129, inlinedAt: !306)
!306 = !DILocation(line: 90, scope: !124, inlinedAt: !298)
!307 = !DILocation(line: 108, scope: !129, inlinedAt: !306)
!308 = !DILocation(line: 369, scope: !135, inlinedAt: !309)
!309 = !DILocation(line: 97, scope: !137, inlinedAt: !310)
!310 = !DILocation(line: 92, scope: !124, inlinedAt: !298)
!311 = distinct !DISubprogram(name: "deepcopy", linkageName: "julia_deepcopy_3117", scope: null, file: !10, line: 24, type: !12, scopeLine: 24, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !9, retainedNodes: !4)
!312 = !DILocation(line: 457, scope: !101, inlinedAt: !313)
!313 = !DILocation(line: 30, scope: !104, inlinedAt: !314)
!314 = !DILocation(line: 48, scope: !104, inlinedAt: !315)
!315 = !DILocation(line: 26, scope: !311)
!316 = !DILocation(line: 42, scope: !114, inlinedAt: !317)
!317 = !DILocation(line: 102, scope: !117, inlinedAt: !318)
!318 = !DILocation(line: 189, scope: !119, inlinedAt: !319)
!319 = !DILocation(line: 17, scope: !121, inlinedAt: !320)
!320 = !DILocation(line: 89, scope: !124, inlinedAt: !315)
!321 = !DILocation(line: 103, scope: !117, inlinedAt: !318)
!322 = !DILocation(line: 107, scope: !129, inlinedAt: !323)
!323 = !DILocation(line: 90, scope: !124, inlinedAt: !315)
!324 = !DILocation(line: 108, scope: !129, inlinedAt: !323)
!325 = !DILocation(line: 369, scope: !135, inlinedAt: !326)
!326 = !DILocation(line: 97, scope: !137, inlinedAt: !327)
!327 = !DILocation(line: 92, scope: !124, inlinedAt: !315)

No augmented forward pass found for jl_eqtable_get
declare {} addrspace(10)* @jl_eqtable_get({} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*) local_unnamed_addr

Stacktrace:
  [1] julia_error(cstr::Cstring, val::Ptr{LLVM.API.LLVMOpaqueValue}, errtype::Enzyme.API.ErrorType, data::Ptr{Nothing})
    @ Enzyme.Compiler ~/.julia/packages/Enzyme/k5kNl/src/compiler.jl:2737
  [2] EnzymeCreatePrimalAndGradient(logic::Enzyme.Logic, todiff::LLVM.Function, retType::Enzyme.API.CDIFFE_TYPE, constant_args::Vector{Enzyme.API.CDIFFE_TYPE}, TA::Enzyme.TypeAnalysis, returnValue::Bool, dretUsed::Bool, mode::Enzyme.API.CDerivativeMode, width::Int64, additionalArg::Ptr{Nothing}, typeInfo::Enzyme.FnTypeInfo, uncacheable_args::Vector{Bool}, augmented::Ptr{Nothing}, atomicAdd::Bool)
    @ Enzyme.API ~/.julia/packages/Enzyme/k5kNl/src/api.jl:111
  [3] enzyme!(job::GPUCompiler.CompilerJob{Enzyme.Compiler.EnzymeTarget, Enzyme.Compiler.EnzymeCompilerParams, GPUCompiler.FunctionSpec{typeof(g), Tuple{Vector{Float64}}}}, mod::LLVM.Module, primalf::LLVM.Function, adjoint::GPUCompiler.FunctionSpec{typeof(g), Tuple{Duplicated{Vector{Float64}}}}, mode::Enzyme.API.CDerivativeMode, width::Int64, parallel::Bool, actualRetType::Type, dupClosure::Bool, wrap::Bool, modifiedBetween::Bool, returnPrimal::Bool)
    @ Enzyme.Compiler ~/.julia/packages/Enzyme/k5kNl/src/compiler.jl:3458
  [4] codegen(output::Symbol, job::GPUCompiler.CompilerJob{Enzyme.Compiler.EnzymeTarget, Enzyme.Compiler.EnzymeCompilerParams, GPUCompiler.FunctionSpec{typeof(g), Tuple{Vector{Float64}}}}; libraries::Bool, deferred_codegen::Bool, optimize::Bool, ctx::LLVM.Context, strip::Bool, validate::Bool, only_entry::Bool, parent_job::Nothing)
    @ Enzyme.Compiler ~/.julia/packages/Enzyme/k5kNl/src/compiler.jl:4366
  [5] _thunk(job::GPUCompiler.CompilerJob{Enzyme.Compiler.EnzymeTarget, Enzyme.Compiler.EnzymeCompilerParams, GPUCompiler.FunctionSpec{typeof(g), Tuple{Vector{Float64}}}})
    @ Enzyme.Compiler ~/.julia/packages/Enzyme/k5kNl/src/compiler.jl:4813
  [6] cached_compilation(job::GPUCompiler.CompilerJob, key::UInt64, specid::UInt64)
    @ Enzyme.Compiler ~/.julia/packages/Enzyme/k5kNl/src/compiler.jl:4851
  [7] #s618#111
    @ ~/.julia/packages/Enzyme/k5kNl/src/compiler.jl:4911 [inlined]
  [8] var"#s618#111"(F::Any, Fn::Any, DF::Any, A::Any, TT::Any, Mode::Any, ModifiedBetween::Any, width::Any, specid::Any, ReturnPrimal::Any, ::Any, #unused#::Type, f::Any, df::Any, #unused#::Type, tt::Any, #unused#::Type, #unused#::Type, #unused#::Type, #unused#::Type, #unused#::Any)
    @ Enzyme.Compiler ./none:0
  [9] (::Core.GeneratedFunctionStub)(::Any, ::Vararg{Any})
    @ Core ./boot.jl:580
 [10] thunk
    @ ~/.julia/packages/Enzyme/k5kNl/src/compiler.jl:4939 [inlined]
 [11] thunk (repeats 2 times)
    @ ~/.julia/packages/Enzyme/k5kNl/src/compiler.jl:4932 [inlined]
 [12] autodiff
    @ ~/.julia/packages/Enzyme/k5kNl/src/Enzyme.jl:293 [inlined]
 [13] autodiff
    @ ~/.julia/packages/Enzyme/k5kNl/src/Enzyme.jl:327 [inlined]
 [14] autodiff(f::typeof(g), args::Duplicated{Vector{Float64}})
    @ Enzyme ~/.julia/packages/Enzyme/k5kNl/src/Enzyme.jl:420
 [15] top-level scope
    @ REPL[35]:1
ryanstoner1 commented 2 years ago

Reduced this down to:

a = [1.0]
da = [0.0]
function g(x)
    y = copy(x)
    d = IdDict() 
    Base.setindex!(d, y, x)
    return sum(y)
end
Enzyme.autodiff(g, Duplicated(a,da))

Based on the offending code in deepcopy():

function _deepcopy_array_t(@nospecialize(x::Array), T, stackdict::IdDict)
    if isbitstype(T)
        return (stackdict[x]=copy(x))
    end

The new error message is:

ERROR: Abstract type Any does not have a definite size.
Stacktrace:
  [1] sizeof(x::Type)
    @ Base ./essentials.jl:476
  [2] array_shadow_handler(B::Ptr{LLVM.API.LLVMOpaqueBuilder}, OrigCI::Ptr{LLVM.API.LLVMOpaqueValue}, numArgs::UInt64, Args::Ptr{Ptr{LLVM.API.LLVMOpaqueValue}})
    @ Enzyme.Compiler ~/.julia/packages/Enzyme/k5kNl/src/compiler.jl:221
  [3] EnzymeCreatePrimalAndGradient(logic::Enzyme.Logic, todiff::LLVM.Function, retType::Enzyme.API.CDIFFE_TYPE, constant_args::Vector{Enzyme.API.CDIFFE_TYPE}, TA::Enzyme.TypeAnalysis, returnValue::Bool, dretUsed::Bool, mode::Enzyme.API.CDerivativeMode, width::Int64, additionalArg::Ptr{Nothing}, typeInfo::Enzyme.FnTypeInfo, uncacheable_args::Vector{Bool}, augmented::Ptr{Nothing}, atomicAdd::Bool)
    @ Enzyme.API ~/.julia/packages/Enzyme/k5kNl/src/api.jl:111
  [4] enzyme!(job::GPUCompiler.CompilerJob{Enzyme.Compiler.EnzymeTarget, Enzyme.Compiler.EnzymeCompilerParams, GPUCompiler.FunctionSpec{typeof(g), Tuple{Vector{Float64}}}}, mod::LLVM.Module, primalf::LLVM.Function, adjoint::GPUCompiler.FunctionSpec{typeof(g), Tuple{Duplicated{Vector{Float64}}}}, mode::Enzyme.API.CDerivativeMode, width::Int64, parallel::Bool, actualRetType::Type, dupClosure::Bool, wrap::Bool, modifiedBetween::Bool, returnPrimal::Bool)
    @ Enzyme.Compiler ~/.julia/packages/Enzyme/k5kNl/src/compiler.jl:3458
  [5] codegen(output::Symbol, job::GPUCompiler.CompilerJob{Enzyme.Compiler.EnzymeTarget, Enzyme.Compiler.EnzymeCompilerParams, GPUCompiler.FunctionSpec{typeof(g), Tuple{Vector{Float64}}}}; libraries::Bool, deferred_codegen::Bool, optimize::Bool, ctx::LLVM.Context, strip::Bool, validate::Bool, only_entry::Bool, parent_job::Nothing)
    @ Enzyme.Compiler ~/.julia/packages/Enzyme/k5kNl/src/compiler.jl:4366
  [6] _thunk(job::GPUCompiler.CompilerJob{Enzyme.Compiler.EnzymeTarget, Enzyme.Compiler.EnzymeCompilerParams, GPUCompiler.FunctionSpec{typeof(g), Tuple{Vector{Float64}}}})
    @ Enzyme.Compiler ~/.julia/packages/Enzyme/k5kNl/src/compiler.jl:4813
  [7] cached_compilation(job::GPUCompiler.CompilerJob, key::UInt64, specid::UInt64)
    @ Enzyme.Compiler ~/.julia/packages/Enzyme/k5kNl/src/compiler.jl:4851
  [8] #s618#111
    @ ~/.julia/packages/Enzyme/k5kNl/src/compiler.jl:4911 [inlined]
  [9] var"#s618#111"(F::Any, Fn::Any, DF::Any, A::Any, TT::Any, Mode::Any, ModifiedBetween::Any, width::Any, specid::Any, ReturnPrimal::Any, ::Any, #unused#::Type, f::Any, df::Any, #unused#::Type, tt::Any, #unused#::Type, #unused#::Type, #unused#::Type, #unused#::Type, #unused#::Any)
    @ Enzyme.Compiler ./none:0
 [10] (::Core.GeneratedFunctionStub)(::Any, ::Vararg{Any})
    @ Core ./boot.jl:580
 [11] thunk
    @ ~/.julia/packages/Enzyme/k5kNl/src/compiler.jl:4939 [inlined]
 [12] thunk (repeats 2 times)
    @ ~/.julia/packages/Enzyme/k5kNl/src/compiler.jl:4932 [inlined]
 [13] autodiff
    @ ~/.julia/packages/Enzyme/k5kNl/src/Enzyme.jl:293 [inlined]
 [14] autodiff
    @ ~/.julia/packages/Enzyme/k5kNl/src/Enzyme.jl:327 [inlined]
 [15] autodiff(f::typeof(g), args::Duplicated{Vector{Float64}})
    @ Enzyme ~/.julia/packages/Enzyme/k5kNl/src/Enzyme.jl:420
 [16] top-level scope
    @ ~/main_drive/research/current_research/3relam/blog/blastest2.jl:32

Due to keys and values in the hash table not being Any's (although whole function is type stable)?

ryanstoner1 commented 2 years ago

Reduced this down further to a ccall in Base.setindex! in deepcopy()

function foo(x)
    d = IdDict{Float64,Float64}()
    key = 1; val = 2
    inserted = Base.RefValue{Cint}(0)
    d.ht = ccall(:jl_eqtable_put, Array{Any,1}, (Any, Any, Any, Ptr{Cint}), d.ht, key, val, inserted)
    return x
end

Enzyme.autodiff(Enzyme.Reverse,foo,Active(1.0))

from

https://github.com/JuliaLang/julia/blob/bb5b98e72a151c41471d8cc14cacb495d647fb7f/base/iddict.jl#L86-L99

error:

ERROR: Enzyme compilation failed.
Current scope: 
; ModuleID = 'text'
source_filename = "text"
target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128-ni:10:11:12:13"
target triple = "arm64-apple-darwin21.3.0"

; Function Attrs: noinline
define dso_local nonnull {} addrspace(10)* @julia_string_7114({} addrspace(10)* nonnull align 16 dereferenceable(40) %0, {} addrspace(10)* nonnull %1) local_unnamed_addr #0 !dbg !9 {
top:
  %2 = call {}*** @julia.get_pgcstack()
  %3 = call cc38 nonnull {} addrspace(10)* bitcast ({} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)**, i32, {} addrspace(10)*)* @ijl_invoke to {} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*)*)({} addrspace(10)* addrspacecast ({}* inttoptr (i64 4510330208 to {}*) to {} addrspace(10)*), {} addrspace(10)* addrspacecast ({}* inttoptr (i64 4788847344 to {}*) to {} addrspace(10)*), {} addrspace(10)* nonnull %0, {} addrspace(10)* nonnull %1) #11, !dbg !11
  ret {} addrspace(10)* %3, !dbg !11
}

; Function Attrs: readnone
declare {}*** @julia.get_pgcstack() local_unnamed_addr #1

declare nonnull {} addrspace(10)* @ijl_invoke({} addrspace(10)*, {} addrspace(10)** nocapture readonly, i32, {} addrspace(10)*) local_unnamed_addr

; Function Attrs: noinline
define dso_local void @julia_print_7112({} addrspace(10)* nonnull %0) local_unnamed_addr #2 !dbg !12 {
top:
  %1 = call {}*** @julia.get_pgcstack()
  %2 = load atomic {} addrspace(10)*, {} addrspace(10)** inttoptr (i64 4781885336 to {} addrspace(10)**) unordered, align 8, !dbg !13, !tbaa !14
  %3 = call cc37 nonnull {} addrspace(10)* bitcast ({} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)**, i32)* @ijl_apply_generic to {} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*)*)({} addrspace(10)* addrspacecast ({}* inttoptr (i64 4784813936 to {}*) to {} addrspace(10)*), {} addrspace(10)* %2, {} addrspace(10)* nonnull %0), !dbg !13
  ret void, !dbg !13
}

declare nonnull {} addrspace(10)* @ijl_apply_generic({} addrspace(10)*, {} addrspace(10)**, i32) local_unnamed_addr #3

; Function Attrs: inaccessiblememonly allocsize(1)
declare noalias nonnull {} addrspace(10)* @julia.gc_alloc_obj({}**, i64, {} addrspace(10)*) local_unnamed_addr #4

; Function Attrs: nounwind readnone
declare nonnull {}* @julia.pointer_from_objref({} addrspace(11)*) local_unnamed_addr #5

declare {} addrspace(10)* @ijl_eqtable_put({} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*, i64) local_unnamed_addr

; Function Attrs: inaccessiblememonly
declare noalias {} addrspace(10)* @ijl_alloc_array_1d({} addrspace(10)*, i64) local_unnamed_addr #6

define double @julia_bar_7106_inner.1(double returned %0) local_unnamed_addr #7 !dbg !19 {
entry:
  %1 = alloca i32, align 8
  %2 = bitcast i32* %1 to i8*
  %3 = call {}*** @julia.get_pgcstack()
  %4 = call noalias nonnull {} addrspace(10)* @ijl_alloc_array_1d({} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 4781985968 to {}*) to {} addrspace(10)*), i64 noundef 32), !dbg !20
  call void @llvm.lifetime.start.p0i8(i64 noundef 4, i8* noundef nonnull %2)
  store i32 0, i32* %1, align 8, !dbg !28, !tbaa !32
  %5 = call nonnull {} addrspace(10)* @julia_string_7114({} addrspace(10)* noundef nonnull align 16 dereferenceable(40) %4, {} addrspace(10)* noundef nonnull align 64 addrspacecast ({}* inttoptr (i64 5732988480 to {}*) to {} addrspace(10)*)) #7, !dbg !35
  call void @julia_print_7112({} addrspace(10)* nonnull %5) #7, !dbg !35
  %6 = ptrtoint i32* %1 to i64, !dbg !36
  %7 = call nonnull {} addrspace(10)* @ijl_eqtable_put({} addrspace(10)* noundef nonnull %4, {} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 4382359648 to {}*) to {} addrspace(10)*), {} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 4382359712 to {}*) to {} addrspace(10)*), i64 noundef %6) [ "jl_roots"({} addrspace(10)* null) ], !dbg !42
  call void @llvm.lifetime.end.p0i8(i64 noundef 4, i8* noundef nonnull %2)
  %8 = call nonnull {} addrspace(10)* @julia_string_7114({} addrspace(10)* noundef nonnull align 16 dereferenceable(40) %7, {} addrspace(10)* noundef nonnull align 8 addrspacecast ({}* inttoptr (i64 5732988504 to {}*) to {} addrspace(10)*)) #7, !dbg !43
  call void @julia_print_7112({} addrspace(10)* nonnull %8) #7, !dbg !43
  ret double %0, !dbg !44
}

; Function Attrs: argmemonly nofree nosync nounwind willreturn
declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture) #8

; Function Attrs: argmemonly nofree nosync nounwind willreturn
declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture) #8

; Function Attrs: inaccessiblememonly nofree nosync nounwind willreturn
declare void @llvm.assume(i1 noundef) #9

; Function Attrs: mustprogress willreturn
define double @preprocess_julia_bar_7106_inner.1(double returned %0) local_unnamed_addr #10 !dbg !45 {
entry:
  %1 = alloca i32, align 8
  %2 = bitcast i32* %1 to i8*
  %3 = call {}*** @julia.get_pgcstack() #12
  %4 = call noalias nonnull {} addrspace(10)* @ijl_alloc_array_1d({} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 4781985968 to {}*) to {} addrspace(10)*), i64 noundef 32) #12, !dbg !46
  call void @llvm.lifetime.start.p0i8(i64 noundef 4, i8* noundef nonnull %2) #12
  store i32 0, i32* %1, align 8, !dbg !50, !tbaa !32
  %5 = call nonnull {} addrspace(10)* @julia_string_7114({} addrspace(10)* noundef nonnull align 16 dereferenceable(40) %4, {} addrspace(10)* noundef nonnull align 64 addrspacecast ({}* inttoptr (i64 5732988480 to {}*) to {} addrspace(10)*)) #10, !dbg !52
  call void @julia_print_7112({} addrspace(10)* nonnull %5) #10, !dbg !52
  %6 = ptrtoint i32* %1 to i64, !dbg !53
  %7 = call nonnull {} addrspace(10)* @ijl_eqtable_put({} addrspace(10)* noundef nonnull %4, {} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 4382359648 to {}*) to {} addrspace(10)*), {} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 4382359712 to {}*) to {} addrspace(10)*), i64 noundef %6) #12 [ "jl_roots"({} addrspace(10)* null) ], !dbg !56
  call void @llvm.lifetime.end.p0i8(i64 noundef 4, i8* noundef nonnull %2) #12
  %8 = call nonnull {} addrspace(10)* @julia_string_7114({} addrspace(10)* noundef nonnull align 16 dereferenceable(40) %7, {} addrspace(10)* noundef nonnull align 8 addrspacecast ({}* inttoptr (i64 5732988504 to {}*) to {} addrspace(10)*)) #10, !dbg !57
  call void @julia_print_7112({} addrspace(10)* nonnull %8) #10, !dbg !57
  ret double %0, !dbg !58
}

; Function Attrs: mustprogress willreturn
define internal { double } @diffejulia_bar_7106_inner.1(double returned %0, double %differeturn) local_unnamed_addr #10 !dbg !59 {
entry:
  %"'ipa" = alloca i32, align 8
  store i32 0, i32* %"'ipa", align 8
  %1 = alloca i32, align 8
  %2 = bitcast i32* %1 to i8*
  %3 = call {}*** @julia.get_pgcstack() #12
  %4 = call noalias nonnull {} addrspace(10)* @ijl_alloc_array_1d({} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 4781985968 to {}*) to {} addrspace(10)*), i64 noundef 32) #12, !dbg !60
  %"'mi" = phi {} addrspace(10)* 
  call void @llvm.lifetime.start.p0i8(i64 noundef 4, i8* noundef nonnull %2) #12
  store i32 0, i32* %1, align 8, !dbg !64, !tbaa !32
  %5 = call nonnull {} addrspace(10)* @julia_string_7114({} addrspace(10)* noundef nonnull align 16 dereferenceable(40) %4, {} addrspace(10)* noundef nonnull align 64 addrspacecast ({}* inttoptr (i64 5732988480 to {}*) to {} addrspace(10)*)) #10, !dbg !66
  call void @julia_print_7112({} addrspace(10)* nonnull %5) #10, !dbg !66
  %"'ipc" = ptrtoint i32* %"'ipa" to i64, !dbg !67
  %6 = ptrtoint i32* %1 to i64, !dbg !67
  %7 = call nonnull {} addrspace(10)* @ijl_eqtable_put({} addrspace(10)* noundef nonnull %4, {} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 4382359648 to {}*) to {} addrspace(10)*), {} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 4382359712 to {}*) to {} addrspace(10)*), i64 noundef %6) #12 [ "jl_roots"({} addrspace(10)* null) ], !dbg !70
  %"'ip_phi" = phi {} addrspace(10)* 
  %8 = call nonnull {} addrspace(10)* @julia_string_7114({} addrspace(10)* noundef nonnull align 16 dereferenceable(40) %7, {} addrspace(10)* noundef nonnull align 8 addrspacecast ({}* inttoptr (i64 5732988504 to {}*) to {} addrspace(10)*)) #10, !dbg !71
  call void @julia_print_7112({} addrspace(10)* nonnull %8) #10, !dbg !71
  br label %invertentry, !dbg !72

allocsForInversion:                               ; No predecessors!
  %"'de" = alloca double, align 8
  store double 0.000000e+00, double* %"'de", align 8

invertentry:                                      ; preds = %entry
  store double %differeturn, double* %"'de", align 8
}

attributes #0 = { noinline "enzyme_inactive" "enzyme_math"="enz_noop" "enzymejl_mi"="4510325568" "probe-stack"="inline-asm" }
attributes #1 = { readnone "enzyme_inactive" }
attributes #2 = { noinline "enzyme_inactive" "enzyme_math"="enz_noop" "enzymejl_mi"="4790044416" "probe-stack"="inline-asm" }
attributes #3 = { "thunk" }
attributes #4 = { inaccessiblememonly allocsize(1) }
attributes #5 = { nounwind readnone }
attributes #6 = { inaccessiblememonly }
attributes #7 = { "probe-stack"="inline-asm" }
attributes #8 = { argmemonly nofree nosync nounwind willreturn }
attributes #9 = { inaccessiblememonly nofree nosync nounwind willreturn }
attributes #10 = { mustprogress willreturn "probe-stack"="inline-asm" }
attributes #11 = { "enzyme_inactive" }
attributes #12 = { mustprogress willreturn }

!llvm.module.flags = !{!0, !1}
!llvm.dbg.cu = !{!2, !5, !7}

!0 = !{i32 2, !"Dwarf Version", i32 4}
!1 = !{i32 2, !"Debug Info Version", i32 3}
!2 = distinct !DICompileUnit(language: DW_LANG_Julia, file: !3, producer: "julia", isOptimized: true, runtimeVersion: 0, emissionKind: LineTablesOnly, enums: !4, nameTableKind: None)
!3 = !DIFile(filename: "strings/io.jl", directory: ".")
!4 = !{}
!5 = distinct !DICompileUnit(language: DW_LANG_Julia, file: !6, producer: "julia", isOptimized: true, runtimeVersion: 0, emissionKind: LineTablesOnly, enums: !4, nameTableKind: None)
!6 = !DIFile(filename: "coreio.jl", directory: ".")
!7 = distinct !DICompileUnit(language: DW_LANG_Julia, file: !8, producer: "julia", isOptimized: true, runtimeVersion: 0, emissionKind: LineTablesOnly, enums: !4, nameTableKind: None)
!8 = !DIFile(filename: "/Users/ryanstoner/main_drive/research/current_research/3relam/blog/testnu.jl", directory: ".")
!9 = distinct !DISubprogram(name: "string", linkageName: "julia_string_7114", scope: null, file: !3, line: 185, type: !10, scopeLine: 185, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !4)
!10 = !DISubroutineType(types: !4)
!11 = !DILocation(line: 185, scope: !9)
!12 = distinct !DISubprogram(name: "print", linkageName: "julia_print_7112", scope: null, file: !6, line: 3, type: !10, scopeLine: 3, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !5, retainedNodes: !4)
!13 = !DILocation(line: 3, scope: !12)
!14 = !{!15, !15, i64 0}
!15 = !{!"jtbaa_binding", !16, i64 0}
!16 = !{!"jtbaa_data", !17, i64 0}
!17 = !{!"jtbaa", !18, i64 0}
!18 = !{!"jtbaa"}
!19 = distinct !DISubprogram(name: "bar", linkageName: "julia_bar_7106", scope: null, file: !8, line: 7, type: !10, scopeLine: 7, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !7, retainedNodes: !4)
!20 = !DILocation(line: 459, scope: !21, inlinedAt: !23)
!21 = distinct !DISubprogram(name: "Array;", linkageName: "Array", scope: !22, file: !22, type: !10, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !7, retainedNodes: !4)
!22 = !DIFile(filename: "boot.jl", directory: ".")
!23 = distinct !DILocation(line: 30, scope: !24, inlinedAt: !26)
!24 = distinct !DISubprogram(name: "IdDict;", linkageName: "IdDict", scope: !25, file: !25, type: !10, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !7, retainedNodes: !4)
!25 = !DIFile(filename: "iddict.jl", directory: ".")
!26 = distinct !DILocation(line: 8, scope: !19, inlinedAt: !27)
!27 = distinct !DILocation(line: 0, scope: !19)
!28 = !DILocation(line: 8, scope: !29, inlinedAt: !31)
!29 = distinct !DISubprogram(name: "RefValue;", linkageName: "RefValue", scope: !30, file: !30, type: !10, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !7, retainedNodes: !4)
!30 = !DIFile(filename: "refvalue.jl", directory: ".")
!31 = distinct !DILocation(line: 11, scope: !19, inlinedAt: !27)
!32 = !{!33, !33, i64 0}
!33 = !{!"jtbaa_mutab", !34, i64 0}
!34 = !{!"jtbaa_value", !16, i64 0}
!35 = !DILocation(line: 12, scope: !19, inlinedAt: !27)
!36 = !DILocation(line: 30, scope: !37, inlinedAt: !39)
!37 = distinct !DISubprogram(name: "convert;", linkageName: "convert", scope: !38, file: !38, type: !10, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !7, retainedNodes: !4)
!38 = !DIFile(filename: "pointer.jl", directory: ".")
!39 = distinct !DILocation(line: 50, scope: !40, inlinedAt: !41)
!40 = distinct !DISubprogram(name: "unsafe_convert;", linkageName: "unsafe_convert", scope: !30, file: !30, type: !10, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !7, retainedNodes: !4)
!41 = distinct !DILocation(line: 13, scope: !19, inlinedAt: !27)
!42 = !DILocation(line: 13, scope: !19, inlinedAt: !27)
!43 = !DILocation(line: 15, scope: !19, inlinedAt: !27)
!44 = !DILocation(line: 0, scope: !19)
!45 = distinct !DISubprogram(name: "bar", linkageName: "julia_bar_7106", scope: null, file: !8, line: 7, type: !10, scopeLine: 7, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !7, retainedNodes: !4)
!46 = !DILocation(line: 459, scope: !21, inlinedAt: !47)
!47 = distinct !DILocation(line: 30, scope: !24, inlinedAt: !48)
!48 = distinct !DILocation(line: 8, scope: !45, inlinedAt: !49)
!49 = distinct !DILocation(line: 0, scope: !45)
!50 = !DILocation(line: 8, scope: !29, inlinedAt: !51)
!51 = distinct !DILocation(line: 11, scope: !45, inlinedAt: !49)
!52 = !DILocation(line: 12, scope: !45, inlinedAt: !49)
!53 = !DILocation(line: 30, scope: !37, inlinedAt: !54)
!54 = distinct !DILocation(line: 50, scope: !40, inlinedAt: !55)
!55 = distinct !DILocation(line: 13, scope: !45, inlinedAt: !49)
!56 = !DILocation(line: 13, scope: !45, inlinedAt: !49)
!57 = !DILocation(line: 15, scope: !45, inlinedAt: !49)
!58 = !DILocation(line: 0, scope: !45)
!59 = distinct !DISubprogram(name: "bar", linkageName: "julia_bar_7106", scope: null, file: !8, line: 7, type: !10, scopeLine: 7, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !7, retainedNodes: !4)
!60 = !DILocation(line: 459, scope: !21, inlinedAt: !61)
!61 = distinct !DILocation(line: 30, scope: !24, inlinedAt: !62)
!62 = distinct !DILocation(line: 8, scope: !59, inlinedAt: !63)
!63 = distinct !DILocation(line: 0, scope: !59)
!64 = !DILocation(line: 8, scope: !29, inlinedAt: !65)
!65 = distinct !DILocation(line: 11, scope: !59, inlinedAt: !63)
!66 = !DILocation(line: 12, scope: !59, inlinedAt: !63)
!67 = !DILocation(line: 30, scope: !37, inlinedAt: !68)
!68 = distinct !DILocation(line: 50, scope: !40, inlinedAt: !69)
!69 = distinct !DILocation(line: 13, scope: !59, inlinedAt: !63)
!70 = !DILocation(line: 13, scope: !59, inlinedAt: !63)
!71 = !DILocation(line: 15, scope: !59, inlinedAt: !63)
!72 = !DILocation(line: 0, scope: !59)

No augmented forward pass found for ijl_eqtable_put
declare {} addrspace(10)* @ijl_eqtable_put({} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*, i64) local_unnamed_addr

Stacktrace:
  [1] julia_error(cstr::Cstring, val::Ptr{LLVM.API.LLVMOpaqueValue}, errtype::Enzyme.API.ErrorType, data::Ptr{Nothing})
    @ Enzyme.Compiler ~/.julia/packages/Enzyme/LixAB/src/compiler.jl:2737
  [2] EnzymeCreatePrimalAndGradient(logic::Enzyme.Logic, todiff::LLVM.Function, retType::Enzyme.API.CDIFFE_TYPE, constant_args::Vector{Enzyme.API.CDIFFE_TYPE}, TA::Enzyme.TypeAnalysis, returnValue::Bool, dretUsed::Bool, mode::Enzyme.API.CDerivativeMode, width::Int64, additionalArg::Ptr{Nothing}, typeInfo::Enzyme.FnTypeInfo, uncacheable_args::Vector{Bool}, augmented::Ptr{Nothing}, atomicAdd::Bool)
    @ Enzyme.API ~/.julia/packages/Enzyme/LixAB/src/api.jl:111
  [3] enzyme!(job::GPUCompiler.CompilerJob{Enzyme.Compiler.EnzymeTarget, Enzyme.Compiler.EnzymeCompilerParams, GPUCompiler.FunctionSpec{typeof(bar), Tuple{Float64}}}, mod::LLVM.Module, primalf::LLVM.Function, adjoint::GPUCompiler.FunctionSpec{typeof(bar), Tuple{Active{Float64}}}, mode::Enzyme.API.CDerivativeMode, width::Int64, parallel::Bool, actualRetType::Type, dupClosure::Bool, wrap::Bool, modifiedBetween::Bool, returnPrimal::Bool)
    @ Enzyme.Compiler ~/.julia/packages/Enzyme/LixAB/src/compiler.jl:3458
  [4] codegen(output::Symbol, job::GPUCompiler.CompilerJob{Enzyme.Compiler.EnzymeTarget, Enzyme.Compiler.EnzymeCompilerParams, GPUCompiler.FunctionSpec{typeof(bar), Tuple{Float64}}}; libraries::Bool, deferred_codegen::Bool, optimize::Bool, ctx::LLVM.Context, strip::Bool, validate::Bool, only_entry::Bool, parent_job::Nothing)
    @ Enzyme.Compiler ~/.julia/packages/Enzyme/LixAB/src/compiler.jl:4366
  [5] _thunk(job::GPUCompiler.CompilerJob{Enzyme.Compiler.EnzymeTarget, Enzyme.Compiler.EnzymeCompilerParams, GPUCompiler.FunctionSpec{typeof(bar), Tuple{Float64}}})
    @ Enzyme.Compiler ~/.julia/packages/Enzyme/LixAB/src/compiler.jl:4771
  [6] cached_compilation(job::GPUCompiler.CompilerJob, key::UInt64, specid::UInt64)
    @ Enzyme.Compiler ~/.julia/packages/Enzyme/LixAB/src/compiler.jl:4809
  [7] #s618#101
    @ ~/.julia/packages/Enzyme/LixAB/src/compiler.jl:4869 [inlined]
  [8] var"#s618#101"(F::Any, Fn::Any, DF::Any, A::Any, TT::Any, Mode::Any, ModifiedBetween::Any, width::Any, specid::Any, ReturnPrimal::Any, ::Any, #unused#::Type, f::Any, df::Any, #unused#::Type, tt::Any, #unused#::Type, #unused#::Type, #unused#::Type, #unused#::Type, #unused#::Any)
    @ Enzyme.Compiler ./none:0
  [9] (::Core.GeneratedFunctionStub)(::Any, ::Vararg{Any})
    @ Core ./boot.jl:582
 [10] thunk
    @ ~/.julia/packages/Enzyme/LixAB/src/compiler.jl:4897 [inlined]
 [11] thunk (repeats 2 times)
    @ ~/.julia/packages/Enzyme/LixAB/src/compiler.jl:4890 [inlined]
 [12] autodiff
    @ ~/.julia/packages/Enzyme/LixAB/src/Enzyme.jl:293 [inlined]
 [13] autodiff(mode::Enzyme.ReverseMode, f::typeof(bar), args::Active{Float64})
    @ Enzyme ~/.julia/packages/Enzyme/LixAB/src/Enzyme.jl:327
 [14] top-level scope
    @ REPL[13]:1
wsmoses commented 2 years ago

Awesome, at this point this one doesn't need to be reduced further. We just need to add that runtime call

wsmoses commented 1 year ago

Should be fixed by https://github.com/EnzymeAD/Enzyme.jl/pull/1073