diff --git a/enzyme/Enzyme/ActivityAnalysis.cpp b/enzyme/Enzyme/ActivityAnalysis.cpp index 81e6c81d1ce3..e5fa1d49b383 100644 --- a/enzyme/Enzyme/ActivityAnalysis.cpp +++ b/enzyme/Enzyme/ActivityAnalysis.cpp @@ -2961,7 +2961,7 @@ bool ActivityAnalyzer::isValueInactiveFromUsers(TypeResults const &TR, } continue; } - if (!I->mayWriteToMemory()) { + if (!I->mayWriteToMemory() || isa(I)) { if (TR.query(I)[{-1}].isIntegral()) { continue; } diff --git a/enzyme/Enzyme/EnzymeLogic.cpp b/enzyme/Enzyme/EnzymeLogic.cpp index 3dcdfbaafb20..9167b6270e90 100644 --- a/enzyme/Enzyme/EnzymeLogic.cpp +++ b/enzyme/Enzyme/EnzymeLogic.cpp @@ -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, @@ -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";