From: Dave Airlie Date: Wed, 11 Nov 2020 01:33:33 +0000 (+1000) Subject: clover: fix compilation with clang + llvm 12. X-Git-Tag: upstream/22.3.5~19363 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6cc1568ff5cffa4c4ac1cd40d3ea5afede99e505;p=platform%2Fupstream%2Fmesa.git 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 Acked-by: Alyssa Rosenzweig Part-of: --- diff --git a/src/gallium/frontends/clover/llvm/invocation.cpp b/src/gallium/frontends/clover/llvm/invocation.cpp index aada225..c3f54c1 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 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 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();