aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Vesely <[email protected]>2018-07-22 14:14:21 -0400
committerJan Vesely <[email protected]>2018-07-26 15:38:22 -0400
commitc2942141ae69e0a9040139dfddefcaf7f211c75b (patch)
treed741016a7817bf9f2a26d50dd6823d299d7dce36
parent8794fe3e30f36fe42d14360d42a5c079c07e6a40 (diff)
clover: Don't extend illegal integer types.
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: [email protected] Signed-off-by: Jan Vesely <[email protected]> Reviewed-by: Francisco Jerez <[email protected]>
-rw-r--r--src/gallium/state_trackers/clover/llvm/codegen/common.cpp3
-rw-r--r--src/gallium/state_trackers/clover/llvm/compat.hpp12
2 files changed, 13 insertions, 2 deletions
diff --git a/src/gallium/state_trackers/clover/llvm/codegen/common.cpp b/src/gallium/state_trackers/clover/llvm/codegen/common.cpp
index ddf2083f37d..ca5f78940d2 100644
--- a/src/gallium/state_trackers/clover/llvm/codegen/common.cpp
+++ b/src/gallium/state_trackers/clover/llvm/codegen/common.cpp
@@ -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);
diff --git a/src/gallium/state_trackers/clover/llvm/compat.hpp b/src/gallium/state_trackers/clover/llvm/compat.hpp
index 60270d15293..975012cbda4 100644
--- a/src/gallium/state_trackers/clover/llvm/compat.hpp
+++ b/src/gallium/state_trackers/clover/llvm/compat.hpp
@@ -155,6 +155,18 @@ namespace clover {
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
+ }
}
}
}