Skip to content

Commit 6d95df2

Browse files
authored
Consider even atomic loads as non-active writing (rust-lang#882)
* Consider even atomic loads as non-active writing * Fix dso local nofree
1 parent 4671621 commit 6d95df2

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

enzyme/Enzyme/ActivityAnalysis.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2961,7 +2961,7 @@ bool ActivityAnalyzer::isValueInactiveFromUsers(TypeResults const &TR,
29612961
}
29622962
continue;
29632963
}
2964-
if (!I->mayWriteToMemory()) {
2964+
if (!I->mayWriteToMemory() || isa<LoadInst>(I)) {
29652965
if (TR.query(I)[{-1}].isIntegral()) {
29662966
continue;
29672967
}

enzyme/Enzyme/EnzymeLogic.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4854,9 +4854,9 @@ llvm::Function *EnzymeLogic::CreateNoFree(Function *F) {
48544854
llvm_unreachable("unhandled, create no free");
48554855
}
48564856

4857-
Function *NewF = Function::Create(F->getFunctionType(), F->getLinkage(),
4857+
Function *NewF = Function::Create(F->getFunctionType(),
4858+
Function::LinkageTypes::InternalLinkage,
48584859
"nofree_" + F->getName(), F->getParent());
4859-
NewF->setLinkage(Function::LinkageTypes::InternalLinkage);
48604860
NewF->setAttributes(F->getAttributes());
48614861
#if LLVM_VERSION_MAJOR >= 9
48624862
NewF->addAttribute(AttributeList::FunctionIndex,
@@ -4942,6 +4942,7 @@ llvm::Function *EnzymeLogic::CreateNoFree(Function *F) {
49424942
}
49434943
}
49444944
}
4945+
NewF->setLinkage(Function::LinkageTypes::InternalLinkage);
49454946

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

0 commit comments

Comments
 (0)