[Mesa-dev] [PATCH] swr: Fix include for createInstructionCombiningPass with llvm-7.0.
Kyriazis, George
george.kyriazis at intel.com
Mon Apr 30 18:05:57 UTC 2018
This patch does not address all the compile issues with llvm trunk (at least the ones that I see in my build).
The following patch, however, works:
diff --git a/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp b/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp
index aadcca2..efb747a 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp
+++ b/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp
@@ -545,7 +545,11 @@ static inline uint32_t ComputeModuleCRC(const llvm::Module* M)
std::string bitcodeBuffer;
raw_string_ostream bitcodeStream(bitcodeBuffer);
+#if LLVM_VERSION_MAJOR >= 7
+ llvm::WriteBitcodeToFile(*M, bitcodeStream);
+#else
llvm::WriteBitcodeToFile(M, bitcodeStream);
+#endif
//M->print(bitcodeStream, nullptr, false);
bitcodeStream.flush();
diff --git a/src/gallium/drivers/swr/rasterizer/jitter/jit_pch.hpp b/src/gallium/drivers/swr/rasterizer/jitter/jit_pch.hpp
index 216938f..001a1ab 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/jit_pch.hpp
+++ b/src/gallium/drivers/swr/rasterizer/jitter/jit_pch.hpp
@@ -69,6 +69,7 @@ using PassManager = llvm::legacy::PassManager;
#include "llvm/Transforms/Scalar.h"
#if LLVM_VERSION_MAJOR >= 7
#include "llvm/Transforms/Utils.h"
+#include "llvm/Transforms/InstCombine/InstCombine.h"
#endif
#include "llvm/Support/Host.h"
#include "llvm/Support/DynamicLibrary.h"
Please feel free to use that as a v2 (since you are already started the patch thread), and I will review.
Thanks,
George
> On Apr 29, 2018, at 1:40 AM, Vinson Lee <vlee at freedesktop.org> wrote:
>
> Fix build error after llvm-7.0.0svn r330669 ("InstCombine: Fix layering
> by not including Scalar.h in InstCombine").
>
> CXX rasterizer/jitter/libmesaswr_la-blend_jit.lo
> rasterizer/jitter/blend_jit.cpp:816:20: error: use of undeclared identifier 'createInstructionCombiningPass'; did you mean 'createInstructionSimplifierPass'?
> passes.add(createInstructionCombiningPass());
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> createInstructionSimplifierPass
>
> Signed-off-by: Vinson Lee <vlee at freedesktop.org>
> ---
> src/gallium/drivers/swr/rasterizer/jitter/jit_pch.hpp | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/src/gallium/drivers/swr/rasterizer/jitter/jit_pch.hpp b/src/gallium/drivers/swr/rasterizer/jitter/jit_pch.hpp
> index 216938fa7b07..6e4d24dde8fa 100644
> --- a/src/gallium/drivers/swr/rasterizer/jitter/jit_pch.hpp
> +++ b/src/gallium/drivers/swr/rasterizer/jitter/jit_pch.hpp
> @@ -66,6 +66,9 @@ using PassManager = llvm::legacy::PassManager;
> #include "llvm/Support/TargetSelect.h"
> #include "llvm/Support/DynamicLibrary.h"
> #include "llvm/Transforms/IPO.h"
> +#if LLVM_VERSION_MAJOR >= 7
> +#include "llvm/Transforms/InstCombine/InstCombine.h"
> +#endif
> #include "llvm/Transforms/Scalar.h"
> #if LLVM_VERSION_MAJOR >= 7
> #include "llvm/Transforms/Utils.h"
> --
> 2.17.0
>
More information about the mesa-dev
mailing list