Skip to content

Commit

Permalink
Clear attribute of generated
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmoses committed Nov 13, 2024
1 parent 624621a commit 69002c0
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions enzyme/Enzyme/EnzymeLogic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1696,8 +1696,22 @@ void clearFunctionAttributes(Function *f) {
if (Arg.hasAttribute(Attribute::StructRet))
Arg.removeAttr(Attribute::StructRet);
}
if (f->hasFnAttribute(Attribute::OptimizeNone))
f->removeFnAttr(Attribute::OptimizeNone);

Attribute::AttrKind fnattrs[] = {
#if LLVM_VERSION_MAJOR >= 16
Attribute::Memory,
#endif
Attribute::ReadOnly,
Attribute::ReadNone,
Attribute::WriteOnly,
Attribute::WillReturn,
Attribute::OptimizeNone
};
for (auto attr : fnattrs) {
if (f->hasFnAttribute(attr)) {
f->removeFnAttr(attr);
}
}

if (f->getAttributes().getRetDereferenceableBytes()) {
f->removeRetAttr(Attribute::Dereferenceable);
Expand Down

0 comments on commit 69002c0

Please sign in to comment.