Skip to content

Commit

Permalink
Fix crash creating closures with LLVM 11
Browse files Browse the repository at this point in the history
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 committed Apr 19, 2021
1 parent e9d0dc3 commit 1978e06
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 @@ -3430,8 +3430,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 1978e06

Please sign in to comment.