Skip to content

Commit

Permalink
fix sret (#1966)
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmoses authored Jul 5, 2024
1 parent fa33a6a commit 803ee2e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions enzyme/Enzyme/CApi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1322,9 +1322,6 @@ void EnzymeFixupBatchedJuliaCallingConvention(LLVMValueRef F_C) {
if (attr.isStringAttribute() &&
attr.getKindAsString() == "enzyme_sret_v") {
sretv = true;
NewAttrs = NewAttrs.addAttribute(
F->getContext(), AttributeList::FirstArgIndex + types.size(),
Attribute::get(F->getContext(), "enzyme_sret"));
} else {
NewAttrs = NewAttrs.addAttribute(
F->getContext(), AttributeList::FirstArgIndex + types.size(), attr);
Expand All @@ -1335,6 +1332,11 @@ void EnzymeFixupBatchedJuliaCallingConvention(LLVMValueRef F_C) {
auto AS = PT->getAddressSpace();
if (AS == 11 || AS == 12 || AS == 13 || sretv) {
for (unsigned i = 0; i < AT->getNumElements(); i++) {
if (sretv) {
NewAttrs = NewAttrs.addAttribute(
F->getContext(), AttributeList::FirstArgIndex + types.size(),
Attribute::get(F->getContext(), "enzyme_sret"));
}
types.push_back(PT);
}
changed.insert(i);
Expand Down

0 comments on commit 803ee2e

Please sign in to comment.