Skip to content

Commit

Permalink
add inline attr to remove one indirection
Browse files Browse the repository at this point in the history
  • Loading branch information
ZuseZ4 committed Aug 21, 2024
1 parent 86dedf7 commit ab54904
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions compiler/rustc_codegen_llvm/src/back/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1069,6 +1069,12 @@ pub(crate) unsafe fn enzyme_ad(
_ => unreachable!(),
};
let mut res: &Value = tmp.0;
// res is getting wrapped, but we don't want the perf overhead of a fnc call indirection.
// So we'll add an alwaysinline attribute to let llvm handle it for us.
let always_inline = llvm::AttributeKind::AlwaysInline;
let attr = llvm::LLVMRustCreateAttrNoValue(llcx, always_inline);
llvm::LLVMRustAddFunctionAttributes(res, 9, &attr, 1);

let size_positions: Vec<usize> = tmp.1;

let f_return_type = LLVMGetReturnType(LLVMGlobalGetValueType(res));
Expand Down

0 comments on commit ab54904

Please sign in to comment.