Skip to content

Commit

Permalink
Consider even atomic loads as non-active writing (#882)
Browse files Browse the repository at this point in the history
* Consider even atomic loads as non-active writing

* Fix dso local nofree
  • Loading branch information
wsmoses authored Oct 5, 2022
1 parent 4671621 commit 6d95df2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion enzyme/Enzyme/ActivityAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2961,7 +2961,7 @@ bool ActivityAnalyzer::isValueInactiveFromUsers(TypeResults const &TR,
}
continue;
}
if (!I->mayWriteToMemory()) {
if (!I->mayWriteToMemory() || isa<LoadInst>(I)) {
if (TR.query(I)[{-1}].isIntegral()) {
continue;
}
Expand Down
5 changes: 3 additions & 2 deletions enzyme/Enzyme/EnzymeLogic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4854,9 +4854,9 @@ llvm::Function *EnzymeLogic::CreateNoFree(Function *F) {
llvm_unreachable("unhandled, create no free");
}

Function *NewF = Function::Create(F->getFunctionType(), F->getLinkage(),
Function *NewF = Function::Create(F->getFunctionType(),
Function::LinkageTypes::InternalLinkage,
"nofree_" + F->getName(), F->getParent());
NewF->setLinkage(Function::LinkageTypes::InternalLinkage);
NewF->setAttributes(F->getAttributes());
#if LLVM_VERSION_MAJOR >= 9
NewF->addAttribute(AttributeList::FunctionIndex,
Expand Down Expand Up @@ -4942,6 +4942,7 @@ llvm::Function *EnzymeLogic::CreateNoFree(Function *F) {
}
}
}
NewF->setLinkage(Function::LinkageTypes::InternalLinkage);

if (llvm::verifyFunction(*NewF, &llvm::errs())) {
llvm::errs() << *F << "\n";
Expand Down

0 comments on commit 6d95df2

Please sign in to comment.