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 <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20146>
This commit is contained in:
Marek Olšák 2022-12-04 06:14:10 -05:00 committed by Marge Bot
parent d3a03d24fc
commit ce0a83efb8

View file

@ -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"));