Skip to content

Commit af10cc9

Browse files
authored
Allow disabling memmove warning (#1637)
1 parent 0c98e26 commit af10cc9

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

enzyme/Enzyme/Utils.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ llvm::cl::opt<bool>
8787
EnzymeStrongZero("enzyme-strong-zero", cl::init(false), cl::Hidden,
8888
cl::desc("Use additional checks to ensure correct "
8989
"behavior when handling functions with inf"));
90+
llvm::cl::opt<bool> EnzymeMemmoveWarning(
91+
"enzyme-memmove-warning", cl::init(true), cl::Hidden,
92+
cl::desc("Warn if using memmove implementation as a fallback for memmove"));
9093
}
9194

9295
void ZeroMemory(llvm::IRBuilder<> &Builder, llvm::Type *T, llvm::Value *obj,
@@ -1240,8 +1243,10 @@ Function *
12401243
getOrInsertDifferentialFloatMemmove(Module &M, Type *T, unsigned dstalign,
12411244
unsigned srcalign, unsigned dstaddr,
12421245
unsigned srcaddr, unsigned bitwidth) {
1243-
llvm::errs() << "warning: didn't implement memmove, using memcpy as fallback "
1244-
"which can result in errors\n";
1246+
if (EnzymeMemmoveWarning)
1247+
llvm::errs()
1248+
<< "warning: didn't implement memmove, using memcpy as fallback "
1249+
"which can result in errors\n";
12451250
return getOrInsertDifferentialFloatMemcpy(M, T, dstalign, srcalign, dstaddr,
12461251
srcaddr, bitwidth);
12471252
}

0 commit comments

Comments
 (0)