From af10cc97ecfca36fec8c185ddf66d2c35ffa0059 Mon Sep 17 00:00:00 2001 From: William Moses Date: Thu, 25 Jan 2024 20:15:31 -0500 Subject: [PATCH] Allow disabling memmove warning (#1637) --- enzyme/Enzyme/Utils.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/enzyme/Enzyme/Utils.cpp b/enzyme/Enzyme/Utils.cpp index 25994fb2bd06..ff44cbaa715d 100644 --- a/enzyme/Enzyme/Utils.cpp +++ b/enzyme/Enzyme/Utils.cpp @@ -87,6 +87,9 @@ llvm::cl::opt EnzymeStrongZero("enzyme-strong-zero", cl::init(false), cl::Hidden, cl::desc("Use additional checks to ensure correct " "behavior when handling functions with inf")); +llvm::cl::opt EnzymeMemmoveWarning( + "enzyme-memmove-warning", cl::init(true), cl::Hidden, + cl::desc("Warn if using memmove implementation as a fallback for memmove")); } void ZeroMemory(llvm::IRBuilder<> &Builder, llvm::Type *T, llvm::Value *obj, @@ -1240,8 +1243,10 @@ Function * getOrInsertDifferentialFloatMemmove(Module &M, Type *T, unsigned dstalign, unsigned srcalign, unsigned dstaddr, unsigned srcaddr, unsigned bitwidth) { - llvm::errs() << "warning: didn't implement memmove, using memcpy as fallback " - "which can result in errors\n"; + if (EnzymeMemmoveWarning) + llvm::errs() + << "warning: didn't implement memmove, using memcpy as fallback " + "which can result in errors\n"; return getOrInsertDifferentialFloatMemcpy(M, T, dstalign, srcalign, dstaddr, srcaddr, bitwidth); }