Mesa (main): fix(FTBFS): clover: work around removal of PointerType::getElementType()

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Mar 23 00:59:10 UTC 2022


Module: Mesa
Branch: main
Commit: 948ad5ac230c5434350fc988c147e28e1b9506ab
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=948ad5ac230c5434350fc988c147e28e1b9506ab

Author: Kai Wasserbäch <kai at dev.carbon-project.org>
Date:   Sat Feb 19 13:03:08 2022 +0100

fix(FTBFS): clover: work around removal of PointerType::getElementType()

`PointerType::getElementType()` was deprected and is gone now [0]. The
*temporary* workaround is using `Type::getPointerElementType()`,
longterm this needs to use [1].

This commit fixes an FTBFS.

[0] <https://github.com/llvm/llvm-project/commit/d593cf79458a59d37e75c886a4fc3ac6a02b484d>
[1] <https://llvm.org/docs/OpaquePointers.html>

Closes: #6042
Cc: mesa-stable
Signed-off-by: Kai Wasserbäch <kai at dev.carbon-project.org>
Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15091>

---

 src/gallium/frontends/clover/llvm/codegen/common.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/gallium/frontends/clover/llvm/codegen/common.cpp b/src/gallium/frontends/clover/llvm/codegen/common.cpp
index ff87d9c2a0a..c9f303a9924 100644
--- a/src/gallium/frontends/clover/llvm/codegen/common.cpp
+++ b/src/gallium/frontends/clover/llvm/codegen/common.cpp
@@ -30,6 +30,7 @@
 /// understood by pipe drivers.
 ///
 
+#include <llvm/IR/Type.h>
 #include <llvm/Support/Allocator.h>
 
 #include "llvm/codegen.hpp"
@@ -203,7 +204,7 @@ namespace {
             // Other types.
             const auto actual_type =
                isa< ::llvm::PointerType>(arg_type) && arg.hasByValAttr() ?
-               cast< ::llvm::PointerType>(arg_type)->getElementType() : arg_type;
+               cast< ::llvm::PointerType>(arg_type)->getPointerElementType() : arg_type;
 
             if (actual_type->isPointerTy()) {
                const unsigned address_space =
@@ -214,7 +215,7 @@ namespace {
                            static_cast<unsigned>(clang::LangAS::opencl_local);
                if (address_space == map[offset]) {
                   const auto pointee_type = cast<
-                     ::llvm::PointerType>(actual_type)->getElementType();
+                     ::llvm::PointerType>(actual_type)->getPointerElementType();
                   args.emplace_back(binary::argument::local, arg_api_size,
                                     target_size,
                                     dl.getABITypeAlignment(pointee_type),



More information about the mesa-commit mailing list