clover: Don't extend illegal integer types.
authorJan Vesely <jan.vesely@rutgers.edu>
Sun, 22 Jul 2018 18:14:21 +0000 (14:14 -0400)
committerJan Vesely <jan.vesely@rutgers.edu>
Thu, 26 Jul 2018 19:38:22 +0000 (15:38 -0400)
It's OK to pass them in memory, which is what kernel invocation needs.
Fixes regressions since llvm r337535 ("Reapply "AMDGPU: Fix handling of alignment padding in DAG argument lowering"):
scalar-arithmetic-char
scalar-arithmetic-uchar
scalar-arithemtic-short
scalar-arithmetic-ushort
scalar-comparison-char
scalar-comparison-uchar
scalar-comparison-short
scalar-comparison-ushort

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
src/gallium/state_trackers/clover/llvm/codegen/common.cpp
src/gallium/state_trackers/clover/llvm/compat.hpp

index ddf2083f37d42503cda487418473c7e9f63737ff..ca5f78940d2aaba9766091524485d7f93f58ad56 100644 (file)
@@ -85,8 +85,7 @@ namespace {
          const unsigned arg_store_size = dl.getTypeStoreSize(arg_type);
          const unsigned arg_api_size = dl.getTypeAllocSize(arg_type);
 
-         const auto target_type = !arg_type->isIntegerTy() ? arg_type :
-            dl.getSmallestLegalIntType(mod.getContext(), arg_store_size * 8);
+         const auto target_type = compat::get_abi_type(arg_type, mod);
          const unsigned target_size = dl.getTypeStoreSize(target_type);
          const unsigned target_align = dl.getABITypeAlignment(target_type);
 
index 60270d152932ed371636814d5709e8a3963bd869..975012cbda4368e42c47ceb653155ff42a55ee4b 100644 (file)
@@ -153,6 +153,18 @@ namespace clover {
                return tm.addPassesToEmitFile(pm, os, nullptr, ft);
 #else
                return tm.addPassesToEmitFile(pm, os, ft);
+#endif
+       }
+
+       template<typename T, typename M>
+       T get_abi_type(const T &arg_type, const M &mod) {
+#if HAVE_LLVM >= 0x0700
+          return arg_type;
+#else
+          ::llvm::DataLayout dl(&mod);
+          const unsigned arg_store_size = dl.getTypeStoreSize(arg_type);
+          return !arg_type->isIntegerTy() ? arg_type :
+            dl.getSmallestLegalIntType(mod.getContext(), arg_store_size * 8);
 #endif
        }
       }