Skip to content

Commit 46d8e9e

Browse files
Merge pull request #2750 from halide/srj-llvm
Fix API change for trunk LLVM
2 parents b848f79 + 7de2b4f commit 46d8e9e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/LLVM_Output.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,11 @@ std::unique_ptr<llvm::Module> clone_module(const llvm::Module &module_in) {
323323
// Write the module to a buffer.
324324
llvm::SmallVector<char, 16> clone_buffer;
325325
llvm::raw_svector_ostream clone_ostream(clone_buffer);
326+
#if LLVM_VERSION >= 70
327+
WriteBitcodeToFile(module_in, clone_ostream);
328+
#else
326329
WriteBitcodeToFile(&module_in, clone_ostream);
330+
#endif
327331

328332
// Read it back in.
329333
llvm::MemoryBufferRef buffer_ref(llvm::StringRef(clone_buffer.data(), clone_buffer.size()), "clone_buffer");
@@ -392,7 +396,11 @@ void compile_llvm_module_to_assembly(llvm::Module &module, Internal::LLVMOStream
392396
}
393397

394398
void compile_llvm_module_to_llvm_bitcode(llvm::Module &module, Internal::LLVMOStream& out) {
399+
#if LLVM_VERSION >= 70
400+
WriteBitcodeToFile(module, out);
401+
#else
395402
WriteBitcodeToFile(&module, out);
403+
#endif
396404
}
397405

398406
void compile_llvm_module_to_llvm_assembly(llvm::Module &module, Internal::LLVMOStream& out) {

0 commit comments

Comments
 (0)