Skip to content

Commit

Permalink
Fix enzyme_inactive removal on return (#1469)
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmoses authored Oct 9, 2023
1 parent a57a98f commit 3194829
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions enzyme/Enzyme/EnzymeLogic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1740,6 +1740,18 @@ void clearFunctionAttributes(Function *f) {
if (f->hasAttribute(llvm::AttributeList::ReturnIndex, attr)) {
f->removeAttribute(llvm::AttributeList::ReturnIndex, attr);
}
#endif
}
for (auto attr : {"enzyme_inactive"}) {
#if LLVM_VERSION_MAJOR >= 14
if (f->getAttributes().hasRetAttribute(attr)) {
f->removeRetAttr(attr);
}
#else
if (f->getAttributes().hasAttribute(llvm::AttributeList::ReturnIndex,
attr)) {
f->removeAttribute(llvm::AttributeList::ReturnIndex, attr);
}
#endif
}
}
Expand Down Expand Up @@ -2564,6 +2576,18 @@ const AugmentedReturn &EnzymeLogic::CreateAugmentedPrimal(
}
#endif
}
for (auto attr : {"enzyme_inactive"}) {
#if LLVM_VERSION_MAJOR >= 14
if (gutils->newFunc->getAttributes().hasRetAttribute(attr)) {
gutils->newFunc->removeRetAttr(attr);
}
#else
if (gutils->newFunc->getAttributes().hasAttribute(
llvm::AttributeList::ReturnIndex, attr)) {
gutils->newFunc->removeAttribute(llvm::AttributeList::ReturnIndex, attr);
}
#endif
}

gutils->eraseFictiousPHIs();

Expand Down

0 comments on commit 3194829

Please sign in to comment.