Skip to content

Commit

Permalink
Simplify enzymejl_needs_restoration (#2187)
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmoses authored Dec 6, 2024
1 parent 57b718b commit a9cc3c9
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions enzyme/tools/enzyme-tblgen/enzyme-tblgen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ void getFunction(const Twine &curIndent, raw_ostream &os, StringRef callval,
os << curIndent << "auto " << callval
<< " = gutils->oldFunc->getParent()->getOrInsertFunction(";
os << Def->getValueInit("name")->getAsString();
os << ", " << FT << ", called->getAttributes()).getCallee();\n";
os << ", " << FT
<< ", called->getAttributes().removeFnAttribute(called->getContext(), "
"\"enzymejl_needs_restoration\")).getCallee();\n";
os << curIndent << "auto " << cconv << " = cast<CallInst>(&" << origName
<< ")->getCallingConv();\n";
return;
Expand All @@ -118,7 +120,9 @@ void getFunction(const Twine &curIndent, raw_ostream &os, StringRef callval,
os << curIndent << "auto " << callval
<< " = gutils->oldFunc->getParent()->getOrInsertFunction(";
os << Def->getValueInit("name")->getAsString();
os << ", " << FT << ", called->getAttributes()).getCallee();\n";
os << ", " << FT
<< ", called->getAttributes().removeFnAttribute(called->getContext(), "
"\"enzymejl_needs_restoration\")).getCallee();\n";
os << curIndent << "auto " << cconv << " = cast<CallInst>(&" << origName
<< ")->getCallingConv();\n";
return;
Expand All @@ -133,7 +137,9 @@ void getFunction(const Twine &curIndent, raw_ostream &os, StringRef callval,
os << curIndent << "auto " << callval
<< " = gutils->oldFunc->getParent()->getOrInsertFunction(";
os << Def->getValueInit("name")->getAsString();
os << ", " << FT << ", called->getAttributes()).getCallee();\n";
os << ", " << FT
<< ", called->getAttributes().removeFnAttribute(called->getContext(), "
"\"enzymejl_needs_restoration\")).getCallee();\n";
os << curIndent << "auto " << cconv << " = cast<CallInst>(&" << origName
<< ")->getCallingConv();\n";
return;
Expand Down

0 comments on commit a9cc3c9

Please sign in to comment.