Skip to content

Commit

Permalink
Fix llvm mainline
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmoses committed Oct 10, 2023
1 parent 070ba6f commit 6a5be03
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions enzyme/Enzyme/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,10 @@ Value *CreateAllocation(IRBuilder<> &Builder, llvm::Type *T, Value *Count,
ZeroMem = nullptr;
}
} else {
#if LLVM_VERSION_MAJOR > 17
res = Builder.CreateMalloc(Count->getType(), T->getType(), Align, Count,
nullptr, Name);
#else
if (Builder.GetInsertPoint() == Builder.GetInsertBlock()->end()) {
res = CallInst::CreateMalloc(Builder.GetInsertBlock(), Count->getType(),
T, Align, Count, nullptr, Name);
Expand All @@ -319,6 +323,7 @@ Value *CreateAllocation(IRBuilder<> &Builder, llvm::Type *T, Value *Count,
}
if (!cast<Instruction>(res)->getParent())
Builder.Insert(cast<Instruction>(res));
#endif

malloccall = dyn_cast<CallInst>(res);
if (malloccall == nullptr) {
Expand Down

0 comments on commit 6a5be03

Please sign in to comment.