clover: Call clang with -O0 for the SPIR-V path
authorJason Ekstrand <jason@jlekstrand.net>
Fri, 14 Aug 2020 20:48:59 +0000 (15:48 -0500)
committerMarge Bot <eric+marge@anholt.net>
Sat, 22 Aug 2020 00:27:07 +0000 (00:27 +0000)
SPIRV-LLVM-Translator isn't really built for handling optimized LLVM IR.
It tends to fall over when, for instance, an optimization generates an
i96 type which isn't legal in SPIR-V.  Pass -O0 to avoid these cases.
See https://github.com/KhronosGroup/SPIRV-LLVM-Translator/issues/203.

Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6432>

src/gallium/frontends/clover/llvm/invocation.cpp

index 38070a94e027a7dce13a3e5673c22d1e5a1b69ad..a305299f507d846ba352f8a54d12f72c8633cbdc 100644 (file)
@@ -450,7 +450,7 @@ clover::llvm::compile_to_spirv(const std::string &source,
       "-spir-unknown-unknown" :
       "-spir64-unknown-unknown";
    auto c = create_compiler_instance(dev, target,
-                                     tokenize(opts + " input.cl"), r_log);
+                                     tokenize(opts + " -O0 input.cl"), r_log);
    auto mod = compile(*ctx, *c, "input.cl", source, headers, dev, opts, false,
                       r_log);