Skip to content

Commit

Permalink
Fix copy memory error [compile time] (#1519)
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmoses authored Nov 2, 2023
1 parent 73ea846 commit b7cf24a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions enzyme/Enzyme/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -640,14 +640,15 @@ void callMemcpyStridedBlas(llvm::IRBuilder<> &B, llvm::Module &M, BlasInfo blas,
llvm::ArrayRef<llvm::Value *> args,
llvm::Type *copy_retty,
llvm::ArrayRef<llvm::OperandBundleDef> bundles) {
Twine copy_name = Twine(blas.prefix) + blas.floatType + "copy" + blas.suffix;
auto copy_name =
std::string(blas.prefix) + blas.floatType + "copy" + blas.suffix;

SmallVector<Type *, 1> tys;
for (auto arg : args)
tys.push_back(arg->getType());

FunctionType *FT = FunctionType::get(copy_retty, tys, false);
auto fn = M.getOrInsertFunction(copy_name.str(), FT);
auto fn = M.getOrInsertFunction(copy_name, FT);
Function *F = cast<Function>(fn.getCallee());
attributeKnownFunctions(*F);

Expand All @@ -657,14 +658,15 @@ void callMemcpyStridedBlas(llvm::IRBuilder<> &B, llvm::Module &M, BlasInfo blas,
void callMemcpyStridedLapack(llvm::IRBuilder<> &B, llvm::Module &M,
BlasInfo blas, llvm::ArrayRef<llvm::Value *> args,
llvm::ArrayRef<llvm::OperandBundleDef> bundles) {
Twine copy_name = Twine(blas.prefix) + blas.floatType + "lacpy" + blas.suffix;
auto copy_name =
std::string(blas.prefix) + blas.floatType + "lacpy" + blas.suffix;

SmallVector<Type *, 1> tys;
for (auto arg : args)
tys.push_back(arg->getType());

auto FT = FunctionType::get(Type::getVoidTy(M.getContext()), tys, false);
auto fn = M.getOrInsertFunction(copy_name.str(), FT);
auto fn = M.getOrInsertFunction(copy_name, FT);
Function *F = cast<Function>(fn.getCallee());
attributeKnownFunctions(*F);

Expand Down

0 comments on commit b7cf24a

Please sign in to comment.