The coroutine split pass is missing a dependency before LLVM 9.0,
and fails to initialise properly if the CallGraphWrapperPass hasn't
be initialised earlier (x86 does it due to some of it's passes
requiring it).
This is a workaround for llvm 8 (coroutines are only supported in 8
and higher). It adds another pass that has a dependency on the pass
the coroutines split requires. This pass shouldn't have any raal
effects.
Fixes: d32690b43c9 (gallivm: add coroutine pass manager support)
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
#endif
#include <llvm-c/BitWriter.h>
#if GALLIVM_HAVE_CORO
+#if LLVM_VERSION_MAJOR <= 8 && defined(PIPE_ARCH_AARCH64)
+#include <llvm-c/Transforms/IPO.h>
+#endif
#include <llvm-c/Transforms/Coroutines.h>
#endif
}
#if GALLIVM_HAVE_CORO
+#if LLVM_VERSION_MAJOR <= 8 && defined(PIPE_ARCH_AARCH64)
+ LLVMAddFunctionAttrsPass(gallivm->cgpassmgr);
+#endif
LLVMAddCoroEarlyPass(gallivm->cgpassmgr);
LLVMAddCoroSplitPass(gallivm->cgpassmgr);
LLVMAddCoroElidePass(gallivm->cgpassmgr);