File tree Expand file tree Collapse file tree 3 files changed +16
-5
lines changed
rustc_codegen_llvm/src/llvm Expand file tree Collapse file tree 3 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -127,7 +127,6 @@ pub(crate) mod Enzyme_AD {
127
127
) ;
128
128
pub ( crate ) fn EnzymeTypeTreeToString ( arg1 : CTypeTreeRef ) -> * const c_char ;
129
129
pub ( crate ) fn EnzymeTypeTreeToStringFree ( arg1 : * const c_char ) ;
130
- pub ( crate ) fn EnzymeGetMaxTypeDepth ( ) -> :: std:: os:: raw:: c_uint ;
131
130
}
132
131
133
132
unsafe extern "C" {
Original file line number Diff line number Diff line change @@ -1847,3 +1847,15 @@ extern "C" void LLVMRustSetNoSanitizeHWAddress(LLVMValueRef Global) {
1847
1847
MD.NoHWAddress = true ;
1848
1848
GV.setSanitizerMetadata (MD);
1849
1849
}
1850
+
1851
+ #ifdef ENZYME
1852
+ extern " C" {
1853
+ extern llvm::cl::opt<unsigned > EnzymeMaxTypeDepth;
1854
+ }
1855
+
1856
+ extern " C" size_t LLVMRustEnzymeGetMaxTypeDepth () { return EnzymeMaxTypeDepth; }
1857
+ #else
1858
+ extern " C" size_t LLVMRustEnzymeGetMaxTypeDepth () {
1859
+ return 6 ; // Default fallback depth
1860
+ }
1861
+ #endif
Original file line number Diff line number Diff line change @@ -2266,16 +2266,16 @@ fn typetree_from_ty_inner<'tcx>(
2266
2266
#[ cfg( llvm_enzyme) ]
2267
2267
{
2268
2268
unsafe extern "C" {
2269
- fn EnzymeGetMaxTypeDepth ( ) -> :: std :: os :: raw :: c_uint ;
2269
+ fn LLVMRustEnzymeGetMaxTypeDepth ( ) -> usize ;
2270
2270
}
2271
- let max_depth = unsafe { EnzymeGetMaxTypeDepth ( ) } as usize ;
2272
- if depth > max_depth {
2271
+ let max_depth = unsafe { LLVMRustEnzymeGetMaxTypeDepth ( ) } ;
2272
+ if depth >= max_depth {
2273
2273
return TypeTree :: new ( ) ;
2274
2274
}
2275
2275
}
2276
2276
2277
2277
#[ cfg( not( llvm_enzyme) ) ]
2278
- if depth > 6 {
2278
+ if depth >= 6 {
2279
2279
return TypeTree :: new ( ) ;
2280
2280
}
2281
2281
You can’t perform that action at this time.
0 commit comments