From ce0a83efb86d693e361587c60d4332f78d682b7d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Sun, 4 Dec 2022 06:14:10 -0500 Subject: [PATCH] ac/llvm: use invariant.load metadata on load intrinsics instead of readnone readnone is illegal now and we should be using invariant.load since LLVM 15. (suggested by Nicolai) Reviewed-by: Pierre-Eric Pelloux-Prayer Part-of: --- src/amd/llvm/ac_llvm_build.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/amd/llvm/ac_llvm_build.c b/src/amd/llvm/ac_llvm_build.c index 0a79b6b..e43f6d6 100644 --- a/src/amd/llvm/ac_llvm_build.c +++ b/src/amd/llvm/ac_llvm_build.c @@ -309,8 +309,12 @@ LLVMValueRef ac_build_intrinsic(struct ac_llvm_context *ctx, const char *name, call = LLVMBuildCall2(ctx->builder, function_type, function, params, param_count, ""); - if (attrib_mask & AC_FUNC_ATTR_READNONE) - LLVMAddCallSiteAttribute(call, -1, ac_get_llvm_attribute(ctx->context, "readnone")); + if (attrib_mask & AC_FUNC_ATTR_READNONE) { + if (LLVM_VERSION_MAJOR >= 15) + LLVMSetMetadata(call, ctx->invariant_load_md_kind, ctx->empty_md); + else + LLVMAddCallSiteAttribute(call, -1, ac_get_llvm_attribute(ctx->context, "readnone")); + } if (attrib_mask & AC_FUNC_ATTR_CONVERGENT) LLVMAddCallSiteAttribute(call, -1, ac_get_llvm_attribute(ctx->context, "convergent")); -- 2.7.4