add optnone noinline to async functions

this works around LLVM optimization assertion failures.
https://bugs.llvm.org/show_bug.cgi?id=36578

closes #800
This commit is contained in:
Andrew Kelley
2018-03-02 13:40:03 -05:00
parent 7d494b3e7b
commit 101b7745c4
2 changed files with 5 additions and 11 deletions

View File

@@ -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) {