I don't know exactly where the standard complex library is defined, or wether or not it is header only, but it seems enzyme can't get its source code.
mod: ; ModuleID = 'complex.cpp'
source_filename = "complex.cpp"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
%"class.std::ios_base::Init" = type { i8 }
%"class.std::basic_ostream" = type { i32 (...)**, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", %"class.std::basic_ostream"*, i8, i8, %"class.std::basic_streambuf"*, %"class.std::ctype"*, %"class.std::num_put"*, %"class.std::num_get"* }
%"class.std::ios_base" = type { i32 (...)**, i64, i64, i32, i32, i32, %"struct.std::ios_base::_Callback_list"*, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, %"struct.std::ios_base::_Words"*, %"class.std::locale" }
%"struct.std::ios_base::_Callback_list" = type { %"struct.std::ios_base::_Callback_list"*, void (i32, %"class.std::ios_base"*, i32)*, i32, i32 }
%"struct.std::ios_base::_Words" = type { i8*, i64 }
%"class.std::locale" = type { %"class.std::locale::_Impl"* }
%"class.std::locale::_Impl" = type { i32, %"class.std::locale::facet"**, i64, %"class.std::locale::facet"**, i8** }
%"class.std::locale::facet" = type <{ i32 (...)**, i32, [4 x i8] }>
%"class.std::basic_streambuf" = type { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, %"class.std::locale" }
%"class.std::ctype" = type <{ %"class.std::locale::facet.base", [4 x i8], %struct.__locale_struct*, i8, [7 x i8], i32*, i32*, i16*, i8, [256 x i8], [256 x i8], i8, [6 x i8] }>
%"class.std::locale::facet.base" = type <{ i32 (...)**, i32 }>
%struct.__locale_struct = type { [13 x %struct.__locale_data*], i16*, i32*, i32*, [13 x i8*] }
%struct.__locale_data = type opaque
%"class.std::num_put" = type { %"class.std::locale::facet.base", [4 x i8] }
%"class.std::num_get" = type { %"class.std::locale::facet.base", [4 x i8] }
%"struct.std::complex" = type { { double, double } }
@_ZStL8__ioinit = internal global %"class.std::ios_base::Init" zeroinitializer, align 1
@__dso_handle = external hidden global i8
@enzyme_dup = dso_local local_unnamed_addr global i32 0, align 4
@enzyme_out = dso_local local_unnamed_addr global i32 0, align 4
@enzyme_const = dso_local local_unnamed_addr global i32 0, align 4
@_ZSt4cout = external dso_local global %"class.std::basic_ostream", align 8
@.str = private unnamed_addr constant [19 x i8] c"The polar form of \00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c" is \00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"*e^i*\00", align 1
@.str.3 = private unnamed_addr constant [5 x i8] c"rad\0A\00", align 1
@.str.4 = private unnamed_addr constant [25 x i8] c"energy of particle is : \00", align 1
@.str.5 = private unnamed_addr constant [30 x i8] c"grad energy of particle is : \00", align 1
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__sub_I_complex.cpp, i8* null }]
declare dso_local void @_ZNSt8ios_base4InitC1Ev(%"class.std::ios_base::Init"*) unnamed_addr #0
; Function Attrs: nounwind
declare dso_local void @_ZNSt8ios_base4InitD1Ev(%"class.std::ios_base::Init"*) unnamed_addr #1
; Function Attrs: nofree nounwind
declare dso_local i32 @__cxa_atexit(void (i8*)*, i8*, i8*) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local double @_Z1hRKSt7complexIdE(%"struct.std::complex"* nocapture nonnull readonly align 8 dereferenceable(16) %c) #3 {
entry:
%_M_value.realp.i.i = getelementptr inbounds %"struct.std::complex", %"struct.std::complex"* %c, i64 0, i32 0, i32 0
%_M_value.real.i.i = load double, double* %_M_value.realp.i.i, align 8
%_M_value.imagp.i.i = getelementptr inbounds %"struct.std::complex", %"struct.std::complex"* %c, i64 0, i32 0, i32 1
%_M_value.imag.i.i = load double, double* %_M_value.imagp.i.i, align 8
%call.i.i = tail call double @cabs(double %_M_value.real.i.i, double %_M_value.imag.i.i) #11
%mul = fmul double %call.i.i, %call.i.i
ret double %mul
}
; Function Attrs: argmemonly nounwind willreturn
declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture) #4
; Function Attrs: argmemonly nounwind willreturn
declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture) #4
; Function Attrs: nounwind readonly uwtable
define dso_local double @_Z2h2RKd(double* nocapture nonnull readonly align 8 dereferenceable(8) %c) #5 {
entry:
%0 = load double, double* %c, align 8, !tbaa !2
%mul = fmul double %0, %0
ret double %mul
}
; Function Attrs: norecurse nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #6 {
entry:
%mycomplex = alloca %"struct.std::complex", align 8
%dc = alloca %"struct.std::complex", align 8
%x = alloca double, align 8
%dx = alloca double, align 8
%0 = bitcast %"struct.std::complex"* %mycomplex to i8*
call void @llvm.lifetime.start.p0i8(i64 16, i8* nonnull %0) #11
%_M_value.realp.i = getelementptr inbounds %"struct.std::complex", %"struct.std::complex"* %mycomplex, i64 0, i32 0, i32 0
%_M_value.imagp.i = getelementptr inbounds %"struct.std::complex", %"struct.std::complex"* %mycomplex, i64 0, i32 0, i32 1
store double 3.000000e+00, double* %_M_value.realp.i, align 8
store double 4.000000e+00, double* %_M_value.imagp.i, align 8
%call1.i17 = tail call nonnull align 8 dereferenceable(8) %"class.std::basic_ostream"* @_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l(%"class.std::basic_ostream"* nonnull align 8 dereferenceable(8) @_ZSt4cout, i8* nonnull getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i64 18) #11
%call1 = call nonnull align 8 dereferenceable(8) %"class.std::basic_ostream"* @_ZStlsIdcSt11char_traitsIcEERSt13basic_ostreamIT0_T1_ES6_RKSt7complexIT_E(%"class.std::basic_ostream"* nonnull align 8 dereferenceable(8) @_ZSt4cout, %"struct.std::complex"* nonnull align 8 dereferenceable(16) %mycomplex) #11
%call1.i19 = call nonnull align 8 dereferenceable(8) %"class.std::basic_ostream"* @_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l(%"class.std::basic_ostream"* nonnull align 8 dereferenceable(8) @_ZSt4cout, i8* nonnull getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64 4) #11
%_M_value.real.i.i = load double, double* %_M_value.realp.i, align 8
%_M_value.imag.i.i = load double, double* %_M_value.imagp.i, align 8
%call.i.i20 = call double @cabs(double %_M_value.real.i.i, double %_M_value.imag.i.i) #11
%call.i21 = call nonnull align 8 dereferenceable(8) %"class.std::basic_ostream"* @_ZNSo9_M_insertIdEERSoT_(%"class.std::basic_ostream"* nonnull @_ZSt4cout, double %call.i.i20) #11
%call1.i23 = call nonnull align 8 dereferenceable(8) %"class.std::basic_ostream"* @_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l(%"class.std::basic_ostream"* nonnull align 8 dereferenceable(8) %call.i21, i8* nonnull getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i64 5) #11
%_M_value.real.i.i25 = load double, double* %_M_value.realp.i, align 8
%_M_value.imag.i.i27 = load double, double* %_M_value.imagp.i, align 8
%call.i.i28 = call double @carg(double %_M_value.real.i.i25, double %_M_value.imag.i.i27) #11
%call.i29 = call nonnull align 8 dereferenceable(8) %"class.std::basic_ostream"* @_ZNSo9_M_insertIdEERSoT_(%"class.std::basic_ostream"* nonnull %call.i21, double %call.i.i28) #11
%call1.i31 = call nonnull align 8 dereferenceable(8) %"class.std::basic_ostream"* @_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l(%"class.std::basic_ostream"* nonnull align 8 dereferenceable(8) %call.i29, i8* nonnull getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i64 4) #11
%call1.i33 = call nonnull align 8 dereferenceable(8) %"class.std::basic_ostream"* @_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l(%"class.std::basic_ostream"* nonnull align 8 dereferenceable(8) @_ZSt4cout, i8* nonnull getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i64 24) #11
%_M_value.real.i.i.i = load double, double* %_M_value.realp.i, align 8
%_M_value.imag.i.i.i = load double, double* %_M_value.imagp.i, align 8
%call.i.i.i = call double @cabs(double %_M_value.real.i.i.i, double %_M_value.imag.i.i.i) #11
%mul.i = fmul double %call.i.i.i, %call.i.i.i
%call.i34 = call nonnull align 8 dereferenceable(8) %"class.std::basic_ostream"* @_ZNSo9_M_insertIdEERSoT_(%"class.std::basic_ostream"* nonnull @_ZSt4cout, double %mul.i) #11
%1 = bitcast %"class.std::basic_ostream"* %call.i34 to i8**
%vtable.i36 = load i8*, i8** %1, align 8, !tbaa !6
%vbase.offset.ptr.i37 = getelementptr i8, i8* %vtable.i36, i64 -24
%2 = bitcast i8* %vbase.offset.ptr.i37 to i64*
%vbase.offset.i38 = load i64, i64* %2, align 8
%3 = bitcast %"class.std::basic_ostream"* %call.i34 to i8*
%add.ptr.i39 = getelementptr inbounds i8, i8* %3, i64 %vbase.offset.i38
%_M_ctype.i50 = getelementptr inbounds i8, i8* %add.ptr.i39, i64 240
%4 = bitcast i8* %_M_ctype.i50 to %"class.std::ctype"**
%5 = load %"class.std::ctype"*, %"class.std::ctype"** %4, align 8, !tbaa !8
%tobool.not.i65 = icmp eq %"class.std::ctype"* %5, null
br i1 %tobool.not.i65, label %if.then.i66, label %_ZSt13__check_facetISt5ctypeIcEERKT_PS3_.exit68
if.then.i66: ; preds = %entry
call void @_ZSt16__throw_bad_castv() #12
unreachable
_ZSt13__check_facetISt5ctypeIcEERKT_PS3_.exit68: ; preds = %entry
%_M_widen_ok.i52 = getelementptr inbounds %"class.std::ctype", %"class.std::ctype"* %5, i64 0, i32 8
%6 = load i8, i8* %_M_widen_ok.i52, align 8, !tbaa !12
%tobool.not.i53 = icmp eq i8 %6, 0
br i1 %tobool.not.i53, label %if.end.i59, label %if.then.i55
if.then.i55: ; preds = %_ZSt13__check_facetISt5ctypeIcEERKT_PS3_.exit68
%arrayidx.i54 = getelementptr inbounds %"class.std::ctype", %"class.std::ctype"* %5, i64 0, i32 9, i64 10
%7 = load i8, i8* %arrayidx.i54, align 1, !tbaa !14
br label %_ZNKSt5ctypeIcE5widenEc.exit61
if.end.i59: ; preds = %_ZSt13__check_facetISt5ctypeIcEERKT_PS3_.exit68
call void @_ZNKSt5ctypeIcE13_M_widen_initEv(%"class.std::ctype"* nonnull %5) #11
%8 = bitcast %"class.std::ctype"* %5 to i8 (%"class.std::ctype"*, i8)***
%vtable.i56 = load i8 (%"class.std::ctype"*, i8)**, i8 (%"class.std::ctype"*, i8)*** %8, align 8, !tbaa !6
%vfn.i57 = getelementptr inbounds i8 (%"class.std::ctype"*, i8)*, i8 (%"class.std::ctype"*, i8)** %vtable.i56, i64 6
%9 = load i8 (%"class.std::ctype"*, i8)*, i8 (%"class.std::ctype"*, i8)** %vfn.i57, align 8
%call.i58 = call signext i8 %9(%"class.std::ctype"* nonnull %5, i8 signext 10) #11
br label %_ZNKSt5ctypeIcE5widenEc.exit61
_ZNKSt5ctypeIcE5widenEc.exit61: ; preds = %if.then.i55, %if.end.i59
%retval.0.i60 = phi i8 [ %7, %if.then.i55 ], [ %call.i58, %if.end.i59 ]
%call1.i41 = call nonnull align 8 dereferenceable(8) %"class.std::basic_ostream"* @_ZNSo3putEc(%"class.std::basic_ostream"* nonnull %call.i34, i8 signext %retval.0.i60) #11
%call.i42 = call nonnull align 8 dereferenceable(8) %"class.std::basic_ostream"* @_ZNSo5flushEv(%"class.std::basic_ostream"* nonnull %call1.i41) #11
%10 = bitcast %"struct.std::complex"* %dc to i8*
call void @llvm.lifetime.start.p0i8(i64 16, i8* nonnull %10) #11
%11 = bitcast double* %x to i8*
call void @llvm.memset.p0i8.i64(i8* nonnull align 8 dereferenceable(16) %10, i8 0, i64 16, i1 false)
call void @llvm.lifetime.start.p0i8(i64 8, i8* nonnull %11) #11
store double -3.000000e+00, double* %x, align 8, !tbaa !2
%12 = bitcast double* %dx to i8*
call void @llvm.lifetime.start.p0i8(i64 8, i8* nonnull %12) #11
store double 0.000000e+00, double* %dx, align 8, !tbaa !2
%13 = load i32, i32* @enzyme_dup, align 4, !tbaa !15
%14 = load double, double* %x, align 8, !tbaa !2
%15 = fadd fast double %14, %14
%16 = load double, double* %dx, align 8
%17 = fadd fast double %16, %15
store double %17, double* %dx, align 8
%18 = load i32, i32* @enzyme_dup, align 4, !tbaa !15
call void (...) @_Z17__enzyme_autodiffz(double (%"struct.std::complex"*)* nonnull @_Z1hRKSt7complexIdE, i32 %18, %"struct.std::complex"* nonnull %mycomplex, %"struct.std::complex"* nonnull %dc) #11
%call1.i46 = call nonnull align 8 dereferenceable(8) %"class.std::basic_ostream"* @_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l(%"class.std::basic_ostream"* nonnull align 8 dereferenceable(8) @_ZSt4cout, i8* nonnull getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), i64 29) #11
%call14 = call nonnull align 8 dereferenceable(8) %"class.std::basic_ostream"* @_ZStlsIdcSt11char_traitsIcEERSt13basic_ostreamIT0_T1_ES6_RKSt7complexIT_E(%"class.std::basic_ostream"* nonnull align 8 dereferenceable(8) @_ZSt4cout, %"struct.std::complex"* nonnull align 8 dereferenceable(16) %dc) #11
%19 = bitcast %"class.std::basic_ostream"* %call14 to i8**
%vtable.i = load i8*, i8** %19, align 8, !tbaa !6
%vbase.offset.ptr.i = getelementptr i8, i8* %vtable.i, i64 -24
%20 = bitcast i8* %vbase.offset.ptr.i to i64*
%vbase.offset.i = load i64, i64* %20, align 8
%21 = bitcast %"class.std::basic_ostream"* %call14 to i8*
%add.ptr.i = getelementptr inbounds i8, i8* %21, i64 %vbase.offset.i
%_M_ctype.i = getelementptr inbounds i8, i8* %add.ptr.i, i64 240
%22 = bitcast i8* %_M_ctype.i to %"class.std::ctype"**
%23 = load %"class.std::ctype"*, %"class.std::ctype"** %22, align 8, !tbaa !8
%tobool.not.i62 = icmp eq %"class.std::ctype"* %23, null
br i1 %tobool.not.i62, label %if.then.i63, label %_ZSt13__check_facetISt5ctypeIcEERKT_PS3_.exit
if.then.i63: ; preds = %_ZNKSt5ctypeIcE5widenEc.exit61
call void @_ZSt16__throw_bad_castv() #12
unreachable
_ZSt13__check_facetISt5ctypeIcEERKT_PS3_.exit: ; preds = %_ZNKSt5ctypeIcE5widenEc.exit61
%_M_widen_ok.i = getelementptr inbounds %"class.std::ctype", %"class.std::ctype"* %23, i64 0, i32 8
%24 = load i8, i8* %_M_widen_ok.i, align 8, !tbaa !12
%tobool.not.i = icmp eq i8 %24, 0
br i1 %tobool.not.i, label %if.end.i, label %if.then.i
if.then.i: ; preds = %_ZSt13__check_facetISt5ctypeIcEERKT_PS3_.exit
%arrayidx.i = getelementptr inbounds %"class.std::ctype", %"class.std::ctype"* %23, i64 0, i32 9, i64 10
%25 = load i8, i8* %arrayidx.i, align 1, !tbaa !14
br label %_ZNKSt5ctypeIcE5widenEc.exit
if.end.i: ; preds = %_ZSt13__check_facetISt5ctypeIcEERKT_PS3_.exit
call void @_ZNKSt5ctypeIcE13_M_widen_initEv(%"class.std::ctype"* nonnull %23) #11
%26 = bitcast %"class.std::ctype"* %23 to i8 (%"class.std::ctype"*, i8)***
%vtable.i48 = load i8 (%"class.std::ctype"*, i8)**, i8 (%"class.std::ctype"*, i8)*** %26, align 8, !tbaa !6
%vfn.i = getelementptr inbounds i8 (%"class.std::ctype"*, i8)*, i8 (%"class.std::ctype"*, i8)** %vtable.i48, i64 6
%27 = load i8 (%"class.std::ctype"*, i8)*, i8 (%"class.std::ctype"*, i8)** %vfn.i, align 8
%call.i49 = call signext i8 %27(%"class.std::ctype"* nonnull %23, i8 signext 10) #11
br label %_ZNKSt5ctypeIcE5widenEc.exit
_ZNKSt5ctypeIcE5widenEc.exit: ; preds = %if.then.i, %if.end.i
%retval.0.i = phi i8 [ %25, %if.then.i ], [ %call.i49, %if.end.i ]
%call1.i = call nonnull align 8 dereferenceable(8) %"class.std::basic_ostream"* @_ZNSo3putEc(%"class.std::basic_ostream"* nonnull %call14, i8 signext %retval.0.i) #11
%call.i = call nonnull align 8 dereferenceable(8) %"class.std::basic_ostream"* @_ZNSo5flushEv(%"class.std::basic_ostream"* nonnull %call1.i) #11
call void @llvm.lifetime.end.p0i8(i64 8, i8* nonnull %12) #11
call void @llvm.lifetime.end.p0i8(i64 8, i8* nonnull %11) #11
call void @llvm.lifetime.end.p0i8(i64 16, i8* nonnull %10) #11
call void @llvm.lifetime.end.p0i8(i64 16, i8* nonnull %0) #11
ret i32 0
}
declare dso_local nonnull align 8 dereferenceable(8) %"class.std::basic_ostream"* @_ZStlsIdcSt11char_traitsIcEERSt13basic_ostreamIT0_T1_ES6_RKSt7complexIT_E(%"class.std::basic_ostream"* nonnull align 8 dereferenceable(8), %"struct.std::complex"* nonnull align 8 dereferenceable(16)) local_unnamed_addr #0
declare dso_local void @_Z17__enzyme_autodiffz(...) local_unnamed_addr #0
; Function Attrs: nofree nounwind
declare dso_local double @cabs(double, double) local_unnamed_addr #7
declare dso_local nonnull align 8 dereferenceable(8) %"class.std::basic_ostream"* @_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l(%"class.std::basic_ostream"* nonnull align 8 dereferenceable(8), i8*, i64) local_unnamed_addr #0
declare dso_local nonnull align 8 dereferenceable(8) %"class.std::basic_ostream"* @_ZNSo9_M_insertIdEERSoT_(%"class.std::basic_ostream"*, double) local_unnamed_addr #0
; Function Attrs: nounwind
declare dso_local double @carg(double, double) local_unnamed_addr #1
declare dso_local nonnull align 8 dereferenceable(8) %"class.std::basic_ostream"* @_ZNSo3putEc(%"class.std::basic_ostream"*, i8 signext) local_unnamed_addr #0
declare dso_local nonnull align 8 dereferenceable(8) %"class.std::basic_ostream"* @_ZNSo5flushEv(%"class.std::basic_ostream"*) local_unnamed_addr #0
; Function Attrs: noreturn
declare dso_local void @_ZSt16__throw_bad_castv() local_unnamed_addr #8
declare dso_local void @_ZNKSt5ctypeIcE13_M_widen_initEv(%"class.std::ctype"*) local_unnamed_addr #0
; Function Attrs: nounwind uwtable
define internal void @_GLOBAL__sub_I_complex.cpp() #9 section ".text.startup" {
entry:
tail call void @_ZNSt8ios_base4InitC1Ev(%"class.std::ios_base::Init"* nonnull @_ZStL8__ioinit) #11
%0 = tail call i32 @__cxa_atexit(void (i8*)* bitcast (void (%"class.std::ios_base::Init"*)* @_ZNSt8ios_base4InitD1Ev to void (i8*)*), i8* getelementptr inbounds (%"class.std::ios_base::Init", %"class.std::ios_base::Init"* @_ZStL8__ioinit, i64 0, i32 0), i8* nonnull @__dso_handle) #11
ret void
}
; Function Attrs: argmemonly nounwind willreturn writeonly
declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #10
; Function Attrs: nounwind readonly uwtable
define dso_local double @preprocess__Z2h2RKd(double* nocapture nonnull readonly align 8 dereferenceable(8) %c) #5 {
entry:
%0 = load double, double* %c, align 8, !tbaa !2
%mul = fmul double %0, %0
ret double %mul
}
; Function Attrs: nounwind uwtable
define internal void @diffe_Z2h2RKd(double* nocapture nonnull readonly align 8 dereferenceable(8) %c, double* nocapture %"c'", double %differeturn) #9 {
entry:
%0 = load double, double* %c, align 8, !tbaa !2
%m0diffe = fmul fast double %differeturn, %0
%1 = fadd fast double %m0diffe, %m0diffe
%2 = load double, double* %"c'", align 8
%3 = fadd fast double %2, %1
store double %3, double* %"c'", align 8
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local double @preprocess__Z1hRKSt7complexIdE(%"struct.std::complex"* nocapture nonnull readonly align 8 dereferenceable(16) %c) #3 {
entry:
%_M_value.realp.i.i = getelementptr inbounds %"struct.std::complex", %"struct.std::complex"* %c, i64 0, i32 0, i32 0
%_M_value.real.i.i = load double, double* %_M_value.realp.i.i, align 8
%_M_value.imagp.i.i = getelementptr inbounds %"struct.std::complex", %"struct.std::complex"* %c, i64 0, i32 0, i32 1
%_M_value.imag.i.i = load double, double* %_M_value.imagp.i.i, align 8
%call.i.i = tail call double @cabs(double %_M_value.real.i.i, double %_M_value.imag.i.i) #11
%mul = fmul double %call.i.i, %call.i.i
ret double %mul
}
; Function Attrs: nofree nounwind uwtable
define internal void @diffe_Z1hRKSt7complexIdE(%"struct.std::complex"* nocapture nonnull readonly align 8 dereferenceable(16) %c, %"struct.std::complex"* nocapture %"c'", double %differeturn) #3 {
entry:
%_M_value.realp.i.i = getelementptr inbounds %"struct.std::complex", %"struct.std::complex"* %c, i64 0, i32 0, i32 0
%_M_value.real.i.i = load double, double* %_M_value.realp.i.i, align 8
%_M_value.imagp.i.i = getelementptr inbounds %"struct.std::complex", %"struct.std::complex"* %c, i64 0, i32 0, i32 1
%_M_value.imag.i.i = load double, double* %_M_value.imagp.i.i, align 8
%call.i.i = tail call double @cabs(double %_M_value.real.i.i, double %_M_value.imag.i.i) #11
%mul_replacementA = phi double
br label %invertentry
allocsForInversion: ; No predecessors!
%"mul'de" = alloca double, align 8
store double 0.000000e+00, double* %"mul'de", align 8
%"call.i.i'de" = alloca double, align 8
store double 0.000000e+00, double* %"call.i.i'de", align 8
invertentry: ; preds = %entry
store double %differeturn, double* %"mul'de", align 8
%0 = load double, double* %"mul'de", align 8
%m0diffecall.i.i = fmul fast double %0, %call.i.i
%m1diffecall.i.i = fmul fast double %0, %call.i.i
store double 0.000000e+00, double* %"mul'de", align 8
%1 = load double, double* %"call.i.i'de", align 8
%2 = fadd fast double %1, %m0diffecall.i.i
store double %2, double* %"call.i.i'de", align 8
%3 = load double, double* %"call.i.i'de", align 8
%4 = fadd fast double %3, %m1diffecall.i.i
store double %4, double* %"call.i.i'de", align 8
}
attributes #0 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #1 = { nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #2 = { nofree nounwind }
attributes #3 = { nofree nounwind uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #4 = { argmemonly nounwind willreturn }
attributes #5 = { nounwind readonly uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #6 = { norecurse nounwind uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #7 = { nofree nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #8 = { noreturn "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #9 = { nounwind uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #10 = { argmemonly nounwind willreturn writeonly }
attributes #11 = { nounwind }
attributes #12 = { noreturn nounwind }
!llvm.module.flags = !{!0}
!llvm.ident = !{!1}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{!"clang version 11.1.0"}
!2 = !{!3, !3, i64 0}
!3 = !{!"double", !4, i64 0}
!4 = !{!"omnipotent char", !5, i64 0}
!5 = !{!"Simple C++ TBAA"}
!6 = !{!7, !7, i64 0}
!7 = !{!"vtable pointer", !5, i64 0}
!8 = !{!9, !10, i64 240}
!9 = !{!"_ZTSSt9basic_iosIcSt11char_traitsIcEE", !10, i64 216, !4, i64 224, !11, i64 225, !10, i64 232, !10, i64 240, !10, i64 248, !10, i64 256}
!10 = !{!"any pointer", !4, i64 0}
!11 = !{!"bool", !4, i64 0}
!12 = !{!13, !4, i64 56}
!13 = !{!"_ZTSSt5ctypeIcE", !10, i64 16, !11, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !4, i64 56, !4, i64 57, !4, i64 313, !4, i64 569}
!14 = !{!4, !4, i64 0}
!15 = !{!16, !16, i64 0}
!16 = !{!"int", !4, i64 0}
; Function Attrs: nofree nounwind
declare dso_local double @cabs(double, double) local_unnamed_addr #7
clang-11: ../Enzyme/EnzymeLogic.cpp:1181: const AugmentedReturn& CreateAugmentedPrimal(llvm::Function*, DIFFE_TYPE, const std::vector<DIFFE_TYPE>&, llvm::TargetLibraryInfo&, TypeAnalysis&, llvm::AAResults&, bool, const FnTypeInfo&, std::map<llvm::Argument*, bool>, bool, bool, bool, bool): Assertion `0 && "attempting to differentiate function without definition"' failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: /home/username/usrlocal/bin/clang-11 -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -disable-free -main-file-name complex.cpp -mrelocation-model static -mframe-pointer=none -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -fno-split-dwarf-inlining -debugger-tuning=gdb -resource-dir /home/username/usrlocal/lib/clang/11.1.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/x86_64-linux-gnu/c++/7.5.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/x86_64-linux-gnu/c++/7.5.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/backward -internal-isystem /usr/local/include -internal-isystem /home/username/usrlocal/lib/clang/11.1.0/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -fdeprecated-macro -fdebug-compilation-dir /home/username/testenzyme -ferror-limit 19 -fgnuc-version=4.2.1 -fcolor-diagnostics -vectorize-loops -vectorize-slp -load /usr/local/lib/ClangEnzyme-11.so -faddrsig -o /tmp/complex-7d9a21.o -x c++ complex.cpp
1. <eof> parser at end of file
2. Per-module optimization passes
3. Running pass 'Enzyme Pass' on module 'complex.cpp'.
#0 0x0000557a0430998a llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/home/username/usrlocal/bin/clang-11+0x1d0f98a)
#1 0x0000557a04307654 llvm::sys::RunSignalHandlers() (/home/username/usrlocal/bin/clang-11+0x1d0d654)
#2 0x0000557a043077a3 SignalHandler(int) (/home/username/usrlocal/bin/clang-11+0x1d0d7a3)
#3 0x00007f1bd04f3980 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x12980)
#4 0x00007f1bcf1a4fb7 raise /build/glibc-S9d2JN/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
#5 0x00007f1bcf1a6921 abort /build/glibc-S9d2JN/glibc-2.27/stdlib/abort.c:81:0
#6 0x00007f1bcf19648a __assert_fail_base /build/glibc-S9d2JN/glibc-2.27/assert/assert.c:89:0
#7 0x00007f1bcf196502 (/lib/x86_64-linux-gnu/libc.so.6+0x30502)
#8 0x00007f1bcec77ef4 CreateAugmentedPrimal(llvm::Function*, DIFFE_TYPE, std::vector<DIFFE_TYPE, std::allocator<DIFFE_TYPE> > const&, llvm::TargetLibraryInfo&, TypeAnalysis&, llvm::AAResults&, bool, FnTypeInfo const&, std::map<llvm::Argument*, bool, std::less<llvm::Argument*>, std::allocator<std::pair<llvm::Argument* const, bool> > >, bool, bool, bool, bool) (/usr/local/lib/ClangEnzyme-11.so+0x445ef4)
#9 0x00007f1bcece1aeb AdjointGenerator<AugmentedReturn const*>::visitCallInst(llvm::CallInst&) (/usr/local/lib/ClangEnzyme-11.so+0x4afaeb)
#10 0x00007f1bcecd8a2b llvm::InstVisitor<AdjointGenerator<AugmentedReturn const*>, void>::delegateCallInst(llvm::CallInst&) (/usr/local/lib/ClangEnzyme-11.so+0x4a6a2b)
#11 0x00007f1bcecb91b3 llvm::InstVisitor<AdjointGenerator<AugmentedReturn const*>, void>::visitCall(llvm::CallInst&) (/usr/local/lib/ClangEnzyme-11.so+0x4871b3)
#12 0x00007f1bcecab549 llvm::InstVisitor<AdjointGenerator<AugmentedReturn const*>, void>::visit(llvm::Instruction&) (/usr/local/lib/ClangEnzyme-11.so+0x479549)
#13 0x00007f1bcec9fe3d llvm::InstVisitor<AdjointGenerator<AugmentedReturn const*>, void>::visit(llvm::Instruction*) (/usr/local/lib/ClangEnzyme-11.so+0x46de3d)
#14 0x00007f1bcec81ae3 CreatePrimalAndGradient(llvm::Function*, DIFFE_TYPE, std::vector<DIFFE_TYPE, std::allocator<DIFFE_TYPE> > const&, llvm::TargetLibraryInfo&, TypeAnalysis&, llvm::AAResults&, bool, bool, bool, llvm::Type*, FnTypeInfo const&, std::map<llvm::Argument*, bool, std::less<llvm::Argument*>, std::allocator<std::pair<llvm::Argument* const, bool> > >, AugmentedReturn const*, bool, bool, bool) (/usr/local/lib/ClangEnzyme-11.so+0x44fae3)
#15 0x00007f1bcec5b378 bool (anonymous namespace)::Enzyme::HandleAutoDiff<llvm::CallInst>(llvm::CallInst*, llvm::TargetLibraryInfo&, llvm::AAResults&, bool) (/usr/local/lib/ClangEnzyme-11.so+0x429378)
#16 0x00007f1bcec574d2 (anonymous namespace)::Enzyme::lowerEnzymeCalls(llvm::Function&, bool, bool&, std::set<llvm::Function*, std::less<llvm::Function*>, std::allocator<llvm::Function*> >&) (/usr/local/lib/ClangEnzyme-11.so+0x4254d2)
#17 0x00007f1bcec57dfb (anonymous namespace)::Enzyme::runOnModule(llvm::Module&) (/usr/local/lib/ClangEnzyme-11.so+0x425dfb)
#18 0x0000557a03cc9a81 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/home/username/usrlocal/bin/clang-11+0x16cfa81)
#19 0x0000557a04589c54 (anonymous namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream> >) (/home/username/usrlocal/bin/clang-11+0x1f8fc54)
#20 0x0000557a0458b6f4 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout const&, llvm::Module*, clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream> >) (/home/username/usrlocal/bin/clang-11+0x1f916f4)
#21 0x0000557a05133df5 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/home/username/usrlocal/bin/clang-11+0x2b39df5)
#22 0x0000557a05cb7fe9 clang::ParseAST(clang::Sema&, bool, bool) (/home/username/usrlocal/bin/clang-11+0x36bdfe9)
#23 0x0000557a05133fa8 clang::CodeGenAction::ExecuteAction() (/home/username/usrlocal/bin/clang-11+0x2b39fa8)
#24 0x0000557a04b1bd39 clang::FrontendAction::Execute() (/home/username/usrlocal/bin/clang-11+0x2521d39)
#25 0x0000557a04ad667a clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home/username/usrlocal/bin/clang-11+0x24dc67a)
#26 0x0000557a04be6486 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home/username/usrlocal/bin/clang-11+0x25ec486)
#27 0x0000557a032070fc cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/home/username/usrlocal/bin/clang-11+0xc0d0fc)
#28 0x0000557a03202479 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) (/home/username/usrlocal/bin/clang-11+0xc08479)
#29 0x0000557a03185fd4 main (/home/username/usrlocal/bin/clang-11+0xb8bfd4)
#30 0x00007f1bcf187bf7 __libc_start_main /build/glibc-S9d2JN/glibc-2.27/csu/../csu/libc-start.c:344:0
#31 0x0000557a03201c4a _start (/home/username/usrlocal/bin/clang-11+0xc07c4a)
clang-11: error: unable to execute command: Aborted (core dumped)
clang-11: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 11.1.0
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
clang-11: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-11: note: diagnostic msg: /tmp/complex-8fd898.cpp
clang-11: note: diagnostic msg: /tmp/complex-8fd898.sh
clang-11: note: diagnostic msg:
********************