about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src
diff options
context:
space:
mode:
authorKaran Janthe <karanjanthe@gmail.com>2025-09-11 07:30:35 +0000
committerKaran Janthe <karanjanthe@gmail.com>2025-09-19 04:11:35 +0000
commit4520926bb527bd43edbf0de84c2b0c6a9c5fc5ce (patch)
tree5bc2f8d378284735c25a81d8e1fe18b0d8a4978c /compiler/rustc_codegen_llvm/src
parent4f3f0f48e7b1e61818b2bcbe4451f89bb4f47049 (diff)
downloadrust-4520926bb527bd43edbf0de84c2b0c6a9c5fc5ce.tar.gz
rust-4520926bb527bd43edbf0de84c2b0c6a9c5fc5ce.zip
autodiff: recurion added for typetree
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
-rw-r--r--compiler/rustc_codegen_llvm/src/llvm/enzyme_ffi.rs1
-rw-r--r--compiler/rustc_codegen_llvm/src/typetree.rs10
2 files changed, 5 insertions, 6 deletions
diff --git a/compiler/rustc_codegen_llvm/src/llvm/enzyme_ffi.rs b/compiler/rustc_codegen_llvm/src/llvm/enzyme_ffi.rs
index e63043b2122..b604f5139c8 100644
--- a/compiler/rustc_codegen_llvm/src/llvm/enzyme_ffi.rs
+++ b/compiler/rustc_codegen_llvm/src/llvm/enzyme_ffi.rs
@@ -127,6 +127,7 @@ pub(crate) mod Enzyme_AD {
         );
         pub(crate) fn EnzymeTypeTreeToString(arg1: CTypeTreeRef) -> *const c_char;
         pub(crate) fn EnzymeTypeTreeToStringFree(arg1: *const c_char);
+        pub(crate) fn EnzymeGetMaxTypeDepth() -> ::std::os::raw::c_uint;
     }
 
     unsafe extern "C" {
diff --git a/compiler/rustc_codegen_llvm/src/typetree.rs b/compiler/rustc_codegen_llvm/src/typetree.rs
index ae6a2da62b5..1a54884f6c5 100644
--- a/compiler/rustc_codegen_llvm/src/typetree.rs
+++ b/compiler/rustc_codegen_llvm/src/typetree.rs
@@ -39,11 +39,7 @@ fn process_typetree_recursive(
 
         let mut indices = parent_indices.to_vec();
         if !parent_indices.is_empty() {
-            if rust_type.offset == -1 {
-                indices.push(-1);
-            } else {
-                indices.push(rust_type.offset as i64);
-            }
+            indices.push(rust_type.offset as i64);
         } else if rust_type.offset == -1 {
             indices.push(-1);
         } else {
@@ -52,7 +48,9 @@ fn process_typetree_recursive(
 
         enzyme_tt.insert(&indices, concrete_type, llcx);
 
-        if rust_type.kind == rustc_ast::expand::typetree::Kind::Pointer && !rust_type.child.0.is_empty() {
+        if rust_type.kind == rustc_ast::expand::typetree::Kind::Pointer
+            && !rust_type.child.0.is_empty()
+        {
             process_typetree_recursive(enzyme_tt, &rust_type.child, &indices, llcx);
         }
     }