Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support more names from MS #1338

Merged
merged 8 commits into from
Aug 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions enzyme/Enzyme/ActivityAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1489,6 +1489,7 @@ bool ActivityAnalyzer::isConstantValue(TypeResults const &TR, Value *Val) {
if (directions & DOWN &&
(funcName == "malloc" || funcName == "calloc" ||
funcName == "_Znwm" || funcName == "julia.gc_alloc_obj" ||
funcName == "??2@YAPAXI@Z" || funcName == "??2@YAPEAX_K@Z" ||
funcName == "jl_gc_alloc_typed" ||
funcName == "ijl_gc_alloc_typed")) {
std::shared_ptr<ActivityAnalyzer> Hypothesis =
Expand Down
4 changes: 3 additions & 1 deletion enzyme/Enzyme/AdjointGenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -8992,7 +8992,9 @@ class AdjointGenerator
Attribute::NonNull);
#endif

if (funcName == "malloc" || funcName == "_Znwm") {
if (funcName == "malloc" || funcName == "_Znwm" ||
funcName == "??2@YAPAXI@Z" ||
funcName == "??2@YAPEAX_K@Z") {
if (auto ci = dyn_cast<ConstantInt>(args[0])) {
unsigned derefBytes = ci->getLimitedValue();
CallInst *cal =
Expand Down
2 changes: 1 addition & 1 deletion enzyme/Enzyme/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ if (${Clang_FOUND})
DEPENDS
intrinsics_gen
PLUGIN_TOOL
opt
clang
)
target_compile_definitions(ClangEnzyme-${LLVM_VERSION_MAJOR} PUBLIC ENZYME_RUNPASS)
endif()
Expand Down
22 changes: 16 additions & 6 deletions enzyme/Enzyme/GradientUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4468,10 +4468,14 @@ Constant *GradientUtils::GetOrCreateShadowConstant(
NewOps.push_back(i == 0 ? C : arg->getOperand(i));
return arg->getWithOperands(NewOps);
}
} else if (auto arg = dyn_cast<GlobalAlias>(oval)) {
return GetOrCreateShadowConstant(Logic, TLI, TA, arg->getAliasee(), mode,
width, AtomicAdd);
} else if (auto arg = dyn_cast<GlobalVariable>(oval)) {
if (arg->getName() == "_ZTVN10__cxxabiv120__si_class_type_infoE" ||
arg->getName() == "_ZTVN10__cxxabiv117__class_type_infoE" ||
arg->getName() == "_ZTVN10__cxxabiv121__vmi_class_type_infoE")
arg->getName() == "_ZTVN10__cxxabiv121__vmi_class_type_infoE" ||
arg->getName().startswith("??_R")) // any of the MS RTTI manglings
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should all MS mangled globals have this treatment though? What about user defined globals!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't like this either but there were too many, and I didn't know how many more there could be. I think this is not a problem because the closest an MS user can get from C/C++ is ?_R... which has one question mark and comes from _R. Besides, such Identifiers are reserved and shouldn't be used anyways.

return arg;

if (hasMetadata(arg, "enzyme_shadow")) {
Expand Down Expand Up @@ -9182,15 +9186,21 @@ llvm::CallInst *freeKnownAllocation(llvm::IRBuilder<> &builder,
freefunc = LibFunc_ZdaPv;
break;

case LibFunc_msvc_new_longlong: // new(unsigned long long);
case LibFunc_msvc_new_longlong_nothrow: // new(unsigned long long, nothrow);
freefunc = LibFunc_msvc_delete_ptr64_longlong;
break;

case LibFunc_msvc_new_array_longlong: // new[](unsigned long long);
case LibFunc_msvc_new_array_longlong_nothrow: // new[](unsigned long long,
// nothrow);
freefunc = LibFunc_msvc_delete_array_ptr64_longlong;
break;
tthsqe12 marked this conversation as resolved.
Show resolved Hide resolved

case LibFunc_msvc_new_int: // new(unsigned int);
case LibFunc_msvc_new_int_nothrow: // new(unsigned int, nothrow);
case LibFunc_msvc_new_longlong: // new(unsigned long long);
case LibFunc_msvc_new_longlong_nothrow: // new(unsigned long long, nothrow);
case LibFunc_msvc_new_array_int: // new[](unsigned int);
case LibFunc_msvc_new_array_int_nothrow: // new[](unsigned int, nothrow);
case LibFunc_msvc_new_array_longlong: // new[](unsigned long long);
case LibFunc_msvc_new_array_longlong_nothrow: // new[](unsigned long long,
// nothrow);
llvm_unreachable("msvc deletion not handled");

default:
Expand Down
5 changes: 1 addition & 4 deletions enzyme/test/Integration/ForwardMode/fwdandrev.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// RUN: %clang++ -std=c++14 -fno-exceptions -O3 %s -S -emit-llvm -o - | %opt - %OPloadEnzyme %enzyme -enzyme-inline=1 -S | %lli -

#include <cmath>
#include "test_utils.h"

template <typename T, int... n>
struct tensor;
Expand All @@ -28,10 +29,6 @@ struct tensor<T, first, rest...> {
tensor<T, rest...> value[first];
};

int enzyme_dup;
int enzyme_out;
int enzyme_const;

template<typename return_type, typename... Args>
return_type __enzyme_autodiff(Args...);

Expand Down
4 changes: 0 additions & 4 deletions enzyme/test/Integration/ForwardMode/nofn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@

#include <stdio.h>

int enzyme_dup;
int enzyme_out;
int enzyme_const;

template < typename return_type, typename ... T >
extern return_type __enzyme_fwddiff(void*, T ... );

Expand Down
4 changes: 0 additions & 4 deletions enzyme/test/Integration/ForwardMode/rosenbrock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@
#include <cmath>
#include <vector>

int enzyme_dup;
int enzyme_out;
int enzyme_const;

using std::vector;

template <typename T> T rosenbrock2(const vector<T> &control) {
Expand Down
1 change: 0 additions & 1 deletion enzyme/test/Integration/ForwardMode/rwrloop.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

#include "test_utils.h"

int enzyme_const, enzyme_dup;
double __enzyme_fwddiff(void*, ...);

double alldiv(double* __restrict__ a, int *__restrict__ N) {
Expand Down
7 changes: 7 additions & 0 deletions enzyme/test/Integration/ForwardMode/test_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
#include <stdbool.h>
#include <math.h>

extern
#ifdef __cplusplus
"C"
#endif
int enzyme_allocated, enzyme_const, enzyme_dup, enzyme_dupnoneed, enzyme_out,
enzyme_tape;

/*
#ifdef __cplusplus
extern "C" {
Expand Down
180 changes: 180 additions & 0 deletions enzyme/test/Integration/ReverseMode/MSinput.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
; RUN: if [ %llvmver -ge 15 ]; then %opt < %s %newLoadEnzyme -enzyme -S | FileCheck %s; fi

%rtti.CompleteObjectLocator = type { i32, i32, i32, i32, i32, i32 }
%rtti.TypeDescriptor13 = type { ptr, ptr, [14 x i8] }
%rtti.ClassHierarchyDescriptor = type { i32, i32, i32, i32 }
%rtti.BaseClassDescriptor = type { i32, i32, i32, i32, i32, i32, i32 }
%rtti.TypeDescriptor12 = type { ptr, ptr, [13 x i8] }
%struct.Object = type { ptr, double }

$"?eval@Object1@@UEAANN@Z" = comdat any

$"??_7Object1@@6B@" = comdat largest

$"??_R4Object1@@6B@" = comdat any

$"??_R0?AUObject1@@@8" = comdat any

$"??_R3Object1@@8" = comdat any

$"??_R2Object1@@8" = comdat any

$"??_R1A@?0A@EA@Object1@@8" = comdat any

$"??_R1A@?0A@EA@Object@@8" = comdat any

$"??_R0?AUObject@@@8" = comdat any

$"??_R3Object@@8" = comdat any

$"??_R2Object@@8" = comdat any

$"??_7Object@@6B@" = comdat largest

$"??_R4Object@@6B@" = comdat any

@0 = private unnamed_addr constant { [2 x ptr] } { [2 x ptr] [ptr @"??_7Object1@@6B@", ptr @"?eval@Object1@@UEAANN@Z"] }, comdat($"??_7Object1@@6B@")
@"??_R4Object1@@6B@" = linkonce_odr constant %rtti.CompleteObjectLocator { i32 1, i32 0, i32 0, i32 trunc (i64 sub nuw nsw (i64 ptrtoint (ptr @"??_R0?AUObject1@@@8" to i64), i64 ptrtoint (ptr @__ImageBase to i64)) to i32), i32 trunc (i64 sub nuw nsw (i64 ptrtoint (ptr @"??_R3Object1@@8" to i64), i64 ptrtoint (ptr @__ImageBase to i64)) to i32), i32 trunc (i64 sub nuw nsw (i64 ptrtoint (ptr @"??_R4Object1@@6B@" to i64), i64 ptrtoint (ptr @__ImageBase to i64)) to i32) }, comdat
@"??_7type_info@@6B@" = external constant ptr
@"??_R0?AUObject1@@@8" = linkonce_odr global %rtti.TypeDescriptor13 { ptr @"??_7type_info@@6B@", ptr null, [14 x i8] c".?AUObject1@@\00" }, comdat
@__ImageBase = external dso_local constant i8
@"??_R3Object1@@8" = linkonce_odr constant %rtti.ClassHierarchyDescriptor { i32 0, i32 0, i32 2, i32 trunc (i64 sub nuw nsw (i64 ptrtoint (ptr @"??_R2Object1@@8" to i64), i64 ptrtoint (ptr @__ImageBase to i64)) to i32) }, comdat
@"??_R2Object1@@8" = linkonce_odr constant [3 x i32] [i32 trunc (i64 sub nuw nsw (i64 ptrtoint (ptr @"??_R1A@?0A@EA@Object1@@8" to i64), i64 ptrtoint (ptr @__ImageBase to i64)) to i32), i32 trunc (i64 sub nuw nsw (i64 ptrtoint (ptr @"??_R1A@?0A@EA@Object@@8" to i64), i64 ptrtoint (ptr @__ImageBase to i64)) to i32), i32 0], comdat
@"??_R1A@?0A@EA@Object1@@8" = linkonce_odr constant %rtti.BaseClassDescriptor { i32 trunc (i64 sub nuw nsw (i64 ptrtoint (ptr @"??_R0?AUObject1@@@8" to i64), i64 ptrtoint (ptr @__ImageBase to i64)) to i32), i32 1, i32 0, i32 -1, i32 0, i32 64, i32 trunc (i64 sub nuw nsw (i64 ptrtoint (ptr @"??_R3Object1@@8" to i64), i64 ptrtoint (ptr @__ImageBase to i64)) to i32) }, comdat
@"??_R1A@?0A@EA@Object@@8" = linkonce_odr constant %rtti.BaseClassDescriptor { i32 trunc (i64 sub nuw nsw (i64 ptrtoint (ptr @"??_R0?AUObject@@@8" to i64), i64 ptrtoint (ptr @__ImageBase to i64)) to i32), i32 0, i32 0, i32 -1, i32 0, i32 64, i32 trunc (i64 sub nuw nsw (i64 ptrtoint (ptr @"??_R3Object@@8" to i64), i64 ptrtoint (ptr @__ImageBase to i64)) to i32) }, comdat
@"??_R0?AUObject@@@8" = linkonce_odr constant %rtti.TypeDescriptor12 { ptr @"??_7type_info@@6B@", ptr null, [13 x i8] c".?AUObject@@\00" }, comdat
@"??_R3Object@@8" = linkonce_odr constant %rtti.ClassHierarchyDescriptor { i32 0, i32 0, i32 1, i32 trunc (i64 sub nuw nsw (i64 ptrtoint (ptr @"??_R2Object@@8" to i64), i64 ptrtoint (ptr @__ImageBase to i64)) to i32)}, comdat
@"??_R2Object@@8" = linkonce_odr constant [2 x i32] [i32 trunc (i64 sub nuw nsw (i64 ptrtoint (ptr @"??_R1A@?0A@EA@Object@@8" to i64), i64 ptrtoint (ptr @__ImageBase to i64)) to i32), i32 0], comdat
@1 = private unnamed_addr constant { [2 x ptr] } { [2 x ptr] [ptr @"??_R4Object@@6B@", ptr @_purecall] }, comdat($"??_7Object@@6B@")
@"??_R4Object@@6B@" = linkonce_odr constant %rtti.CompleteObjectLocator { i32 1, i32 0, i32 0, i32 trunc (i64 sub nuw nsw (i64 ptrtoint (ptr @"??_R0?AUObject@@@8" to i64), i64 ptrtoint (ptr @__ImageBase to i64)) to i32), i32 trunc (i64 sub nuw nsw (i64 ptrtoint (ptr @"??_R3Object@@8" to i64), i64 ptrtoint( ptr @__ImageBase to i64)) to i32), i32 trunc (i64 sub nuw nsw (i64 ptrtoint (ptr @"??_R4Object@@6B@" to i64), i64 ptrtoint (ptr @__ImageBase to i64)) to i32) }, comdat

@"??_7Object1@@6B@" = unnamed_addr alias ptr, getelementptr inbounds ({ [2 x ptr] }, ptr @0, i32 0, i32 0, i32 1)
@"??_7Object@@6B@" = unnamed_addr alias ptr, getelementptr inbounds ({ [2 x ptr] }, ptr @1, i32 0, i32 0, i32 1)

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef double @"?new_delete_test@@YANPEAN_K@Z"(ptr nocapture noundef readonly %x, i64 noundef %n) #0 {
entry:
%0 = tail call {i64, i1} @llvm.umul.with.overflow.i64(i64 %n, i64 8)
%1 = extractvalue { i64, i1 } %0, 1
%2 = extractvalue { i64, i1 } %0, 0
%3 = select i1 %1, i64 -1, i64 %2
%call = tail call noalias noundef nonnull ptr @"??_U@YAPEAX_K@Z"(i64 noundef %3) #6
br label %do.body

do.body: ; preds = %do.body, %entry
%indvars.iv = phi i64 [ %indvars.iv.next, %do.body ], [ 0, %entry ]
%call1 = tail call noalias noundef nonnull dereferenceable(8) ptr @"??2@YAPEAX_K@Z"(i64 noundef 8) #6
%arrayidx = getelementptr inbounds ptr, ptr %call, i64 %indvars.iv
store ptr %call1, ptr %arrayidx, align 8, !tbaa !5
%arrayidx3 = getelementptr inbounds double, ptr %x, i64 %indvars.iv
%4 = load double, ptr %arrayidx3, align 8, !tbaa !9
%mul = fmul double %4, %4
store double %mul, ptr %arrayidx3, align 8, !tbaa !9
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%cmp = icmp ult i64 %indvars.iv.next, %n
br i1 %cmp, label %do.body, label %do.body8.preheader, !llvm.loop !11

do.body8.preheader: ; preds = %do.body
%sext = shl i64 %indvars.iv.next, 32
%5 = ashr exact i64 %sext, 32
br label %do.body8

do.body8: ; preds = %do.body8.preheader, %do.body8
%indvars.iv38 = phi i64 [ %5, %do.body8.preheader ], [ %indvars.iv.next39, %do.body8 ]
%res.0 = phi double [ 0.000000e+00, %do.body8.preheader ], [ %add, %do.body8 ]
%arrayidx10 = getelementptr inbounds ptr, ptr %call, i64 %indvars.iv38
%6 = load ptr, ptr %arrayidx10, align 8, !tbaa !5
%7 = load double, ptr %6, align 8, !tbaa !9
%add = fadd double %res.0, %7
tail call void @"??3@YAXPEAX@Z"(ptr noundef %6) #7
%indvars.iv.next39 = add i64 %indvars.iv38, 1
%cmp16 = icmp ult i64 %indvars.iv.next39, %n
br i1 %cmp16, label %do.body8, label %delete.notnull19, !llvm.loop !14

delete.notnull19:
tail call void @"??_V@YAXPEAX@Z"(ptr noundef nonnull %call) #7
ret double %add
}

; Function Attrs: mustprogress nocallback nofree nosync nounwind readnone speculatable willreturn
declare { i64, i1 } @llvm.umul.with.overflow.i64(i64, i64) #1

; Function Attrs: nobuiltin allocsize(0)
declare dso_local noundef nonnull ptr @"??_U@YAPEAX_K@Z"(i64 noundef) local_unnamed_addr #2

; Function Attrs: nobuiltin allocsize(0)
declare dso_local noundef nonnull ptr @"??2@YAPEAX_K@Z"(i64 noundef) local_unnamed_addr #2

; Function Attrs: nobuiltin nounwind
declare dso_local void @"??3@YAXPEAX@Z"(ptr noundef ) local_unnamed_addr #3

; Function Attrs: nobuiltin nounwind
declare dso_local void @"??_V@YAXPEAX@Z"(ptr noundef ) local_unnamed_addr #3

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @"?new_delete_test_b@@YEAXPEAN0_K@Z"(ptr noundef %x, ptr noundef %x_b, i64 noundef %n) local_unnamed_addr #0 {
entry:
tail call void @"??$__enzyme_autodiff@XPEANPEAN_K@@YAXPEAXPEAN1_K@Z"(ptr noundef nonnull@"?new_delete_test@@YANPEAN_K@Z", ptr noundef %x, ptr noundef %x_b, i64 noundef %n) #8
ret void
}

declare dso_local void @"??$__enzyme_autodiff@XPEANPEAN_K@@YAXPEAXPEAN1_K@Z"(ptr noundef, ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef double @"?eval@@YANAEAUObject@@N@Z"(ptr noundef nonnull align 8 dereferenceable(16) %o, double noundef %v) local_unnamed_addr #0 {
entry:
%vtable = load ptr, ptr %o, align 8, !tbaa !15
%0 = load ptr, ptr %vtable, align 8
%call = tail call noundef double %0(ptr noundef nonnull align 8 dereferenceable(16) %o, double noundef %v) #8
ret double %call
}

; Function Attrs: nounwind uwtable
define dso_local void @"?aliased_rtti_test@@YAXN@Z"(double noundef %v) local_unnamed_addr #5 {
entry:
%call4 = tail call noundef ptr @"??$__enzyme_virtualreverse@PEAX@@YAPEAXPEAX@Z"(ptr noundef nonnull @"??_7Object1@@6B@") #8
ret void
}

declare dso_local noundef ptr @"??$__enzyme_virtualreverse@PEAX@@YAPEAXPEAX@Z"(ptr noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind uwtable
define linkonce_odr dso_local noundef double @"?eval@Object1@@UEAANN@Z"(ptr noundef nonnull align 8 dereferenceable(16) %this, double noundef %v) unnamed_addr #0 comdat align 2 {
entry:
%val = getelementptr inbounds %struct.Object, ptr %this, i64 0, i32 1
%0 = load double, ptr %val, align 8, !tbaa !17
%mul = fmul double %0, %v
ret double %mul
}

declare dso_local void @_purecall() unnamed_addr

attributes #0 = { mustprogress nounwind uwtable "frame-pointer"="none" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind readnone speculatable willreturn }
attributes #2 = { nobuiltin allocsize(0) "frame-pointer"="none" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nobuiltin nounwind "frame-pointer"="none" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { "frame-pointer"="none" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind uwtable "frame-pointer"="none" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { builtin nounwind allocsize(0) }
attributes #7 = { builtin nounwind }
attributes #8 = { nounwind }


!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = distinct !{!11, !12, !13}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!"llvm.loop.unroll.disable"}
!14 = distinct !{!14, !12, !13}
!15 = !{!16, !16, i64 0}
!16 = !{!"vtable pointer", !8, i64 0}
!17 = !{!18, !10, i64 8}
!18 = !{!"?AUObject@@", !10, i64 8}

; CHECK: %rtti.CompleteObjectLocator = type { i32, i32, i32, i32, i32, i32 }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would change the check lines to be the generated derivative functions

; CHECK: define internal void @"diffe?new_delete_test@@YANPEAN_K@Z"
; CHECK: define internal { double } @"diffe?eval@Object1@@UEAANN@Z"
1 change: 0 additions & 1 deletion enzyme/test/Integration/ReverseMode/allocatedtape.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

#include "test_utils.h"

extern int enzyme_dup, enzyme_allocated, enzyme_tape;
void __enzyme_autodiff(void*, ...);
void* __enzyme_augmentfwd(void*, ...);
void __enzyme_reverse(void*, ...);
Expand Down
2 changes: 1 addition & 1 deletion enzyme/test/Integration/ReverseMode/allocatedtape_err.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
// RUN: if [ %llvmver -ge 12 ]; then %clang -std=c11 -g -O3 %s -S -emit-llvm -o - %newLoadClangEnzyme -Xclang -verify; fi

#include <math.h>
#include "test_utils.h"

extern int enzyme_allocated, enzyme_tape;
void __enzyme_reverse(void*, ...);

void f(double* x) {
Expand Down
6 changes: 1 addition & 5 deletions enzyme/test/Integration/ReverseMode/cmplx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@
#include <math.h>
#include <complex> // std::complex, std::abs, std::arg

int enzyme_dup;
int enzyme_out;
int enzyme_const;

void __enzyme_autodiff(...);

using namespace std;
Expand Down Expand Up @@ -62,4 +58,4 @@ int main ()
APPROX_EQ(imag(dc), 8.0, 1e-7);

return 0;
}
}
2 changes: 0 additions & 2 deletions enzyme/test/Integration/ReverseMode/map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
#include <unordered_map>
#include <string>

int enzyme_dup;

using dictSU = std::unordered_map<std::string, double>;
using dictCU = std::unordered_map<const char*, double>;

Expand Down
2 changes: 0 additions & 2 deletions enzyme/test/Integration/ReverseMode/metarwr.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ void alldiv(double* __restrict__ a, long** meta) {
a[0] = 0;
}

int enzyme_dup, enzyme_const;

int main(int argc, char** argv) {

long meta[2] = { 198, 200 };
Expand Down
4 changes: 1 addition & 3 deletions enzyme/test/Integration/ReverseMode/omp3.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

# include <stdlib.h>
# include <stdio.h>

#include "test_utils.h"

void msg(double* in, int *len, unsigned int slen) {
if (slen != 0) {
Expand All @@ -28,8 +28,6 @@ void msg(double* in, int *len, unsigned int slen) {
}
}

int enzyme_dup, enzyme_const;

void __enzyme_autodiff(void*, ...);

int main ( int argc, char *argv[] ) {
Expand Down
2 changes: 0 additions & 2 deletions enzyme/test/Integration/ReverseMode/perturbation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ static double f(double x, double y) {
return x * y;
}

extern int enzyme_const;

static double df(double x) {
return x * __enzyme_autodiff1((void*)f, enzyme_const, x, 3.0);
}
Expand Down
Loading