Mesa (main): clover: fix compilation with clang + llvm 12.
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Aug 10 21:57:27 UTC 2021
Module: Mesa
Branch: main
Commit: 6cc1568ff5cffa4c4ac1cd40d3ea5afede99e505
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6cc1568ff5cffa4c4ac1cd40d3ea5afede99e505
Author: Dave Airlie <airlied at redhat.com>
Date: Wed Nov 11 11:33:33 2020 +1000
clover: fix compilation with clang + llvm 12.
clang in llvm 12 no longer accepts "-cl-denorms-are-zero" as a cc1
options which is how this code uses it.
For now just pick the correct cc1 equivalent.
This fixes a crash with llvm master and CL conversions tests
Reviewed-by: Karol Herbst <kherbst at redhat.com>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12286>
---
src/gallium/frontends/clover/llvm/invocation.cpp | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/src/gallium/frontends/clover/llvm/invocation.cpp b/src/gallium/frontends/clover/llvm/invocation.cpp
index aada225e366..c3f54c1ed2c 100644
--- a/src/gallium/frontends/clover/llvm/invocation.cpp
+++ b/src/gallium/frontends/clover/llvm/invocation.cpp
@@ -224,8 +224,18 @@ namespace {
// Parse the compiler options. A file name should be present at the end
// and must have the .cl extension in order for the CompilerInvocation
// class to recognize it as an OpenCL source file.
+#if LLVM_VERSION_MAJOR >= 12
+ std::vector<const char *> copts;
+ for (auto &opt : opts) {
+ if (opt == "-cl-denorms-are-zero")
+ copts.push_back("-fdenormal-fp-math=positive-zero");
+ else
+ copts.push_back(opt.c_str());
+ }
+#else
const std::vector<const char *> copts =
map(std::mem_fn(&std::string::c_str), opts);
+#endif
const target &target = ir_target;
const cl_version device_clc_version = dev.device_clc_version();
More information about the mesa-commit
mailing list