File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed
compiler/rustc_codegen_llvm/src Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -136,6 +136,13 @@ fn generate_enzyme_call<'ll>(
136136 let enzyme_dup = cx. create_metadata ( "enzyme_dup" . to_string ( ) ) . unwrap ( ) ;
137137 let enzyme_dupnoneed = cx. create_metadata ( "enzyme_dupnoneed" . to_string ( ) ) . unwrap ( ) ;
138138 let enzyme_primal_ret = cx. create_metadata ( "enzyme_primal_return" . to_string ( ) ) . unwrap ( ) ;
139+ let enzyme_width = cx. create_metadata ( "enzyme_width" . to_string ( ) ) . unwrap ( ) ;
140+
141+ // FIXME(ZuseZ4): Find out, how enzyme_primal_ret and enzyme_width are combinable.
142+ if attrs. width > 1 {
143+ args. push ( cx. get_metadata_value ( enzyme_width) ) ;
144+ args. push ( cx. get_const_i64 ( attrs. width as u64 ) ) ;
145+ }
139146
140147 match output {
141148 DiffActivity :: Dual => {
Original file line number Diff line number Diff line change @@ -637,6 +637,11 @@ impl<'ll> SimpleCx<'ll> {
637637 unsafe { llvm:: LLVMMetadataAsValue ( self . llcx , metadata) }
638638 }
639639
640+ pub ( crate ) fn get_const_i64 ( & self , n : u64 ) -> & ' ll Value {
641+ let ty = unsafe { llvm:: LLVMInt64TypeInContext ( self . llcx ) } ;
642+ unsafe { llvm:: LLVMConstInt ( ty, n, llvm:: False ) }
643+ }
644+
640645 pub ( crate ) fn get_function ( & self , name : & str ) -> Option < & ' ll Value > {
641646 let name = SmallCStr :: new ( name) ;
642647 unsafe { llvm:: LLVMGetNamedFunction ( self . llmod , name. as_ptr ( ) ) }
You can’t perform that action at this time.
0 commit comments