Skip to content

Commit

Permalink
Fix crash generating closure functions calls with LLVM 11 (AcademySof…
Browse files Browse the repository at this point in the history
…twareFoundation#1361)

Generating code for prepare_closure and gen_closure was crashing.
The code now matches the implementation of the removed LLVM function.

Signed-off-by: Brecht Van Lommel <brecht@blender.org>
  • Loading branch information
brechtvl authored and lgritz committed Apr 22, 2021
1 parent a2b97d0 commit ac46738
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/liboslexec/llvm_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2448,8 +2448,9 @@ LLVM_Util::call_function (llvm::Value *func, cspan<llvm::Value *> args)
#endif
//llvm_gen_debug_printf (std::string("start ") + std::string(name));
#if OSL_LLVM_VERSION >= 110
OSL_DASSERT(llvm::isa<llvm::Function>(func));
llvm::Value *r = builder().CreateCall(llvm::cast<llvm::Function>(func), llvm::ArrayRef<llvm::Value *>(args.data(), args.size()));
llvm::Value* r = builder().CreateCall(
llvm::cast<llvm::FunctionType>(func->getType()->getPointerElementType()), func,
llvm::ArrayRef<llvm::Value*>(args.data(), args.size()));
#else
llvm::Value *r = builder().CreateCall (func, llvm::ArrayRef<llvm::Value *>(args.data(), args.size()));
#endif
Expand Down

0 comments on commit ac46738

Please sign in to comment.