From 101b7745c4da1fdf0ebe723710fe8b195013fc0e Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Fri, 2 Mar 2018 13:40:03 -0500 Subject: add optnone noinline to async functions this works around LLVM optimization assertion failures. https://bugs.llvm.org/show_bug.cgi?id=36578 closes #800 --- src/codegen.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/codegen.cpp') diff --git a/src/codegen.cpp b/src/codegen.cpp index 0cfd27322f..3aa8f63100 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -489,6 +489,10 @@ static LLVMValueRef fn_llvm_value(CodeGen *g, FnTableEntry *fn_table_entry) { } else { LLVMSetFunctionCallConv(fn_table_entry->llvm_value, get_llvm_cc(g, fn_type->data.fn.fn_type_id.cc)); } + if (fn_type->data.fn.fn_type_id.cc == CallingConventionAsync) { + addLLVMFnAttr(fn_table_entry->llvm_value, "optnone"); + addLLVMFnAttr(fn_table_entry->llvm_value, "noinline"); + } bool want_cold = fn_table_entry->is_cold || fn_type->data.fn.fn_type_id.cc == CallingConventionCold; if (want_cold) { -- cgit v1.2.3