From 8714b107cd8794f0818a281dfc56c0e49af05ba1 Mon Sep 17 00:00:00 2001 From: Yang Rong Date: Wed, 18 Oct 2017 14:57:14 +0800 Subject: GBE: Fix a TBAA issue against llvm5.0. Casting from pointer of char to pointer of int breaks llvm TypeBasedAliasAnalysis. So we use may_alias attribute to explicitly tell the TBAA that it may alias other data type memory access. Signed-off-by: Ruiling Song Reviewed-by: Yang Rong --- backend/src/libocl/src/ocl_memcpy.cl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/src/libocl/src/ocl_memcpy.cl b/backend/src/libocl/src/ocl_memcpy.cl index 131574d9..8c0409a3 100644 --- a/backend/src/libocl/src/ocl_memcpy.cl +++ b/backend/src/libocl/src/ocl_memcpy.cl @@ -16,12 +16,13 @@ * */ #include "ocl_memcpy.h" +typedef int __attribute__((may_alias)) AI; #define DECL_TWO_SPACE_MEMCOPY_FN(NAME, DST_SPACE, SRC_SPACE) \ void __gen_memcpy_ ##NAME## _align (DST_SPACE uchar* dst, SRC_SPACE uchar* src, size_t size) { \ size_t index = 0; \ while((index + 4) <= size) { \ - *((DST_SPACE uint *)(dst + index)) = *((SRC_SPACE uint *)(src + index)); \ + *((DST_SPACE AI *)(dst + index)) = *((SRC_SPACE AI *)(src + index)); \ index += 4; \ } \ while(index < size) { \ -- cgit v1.2.1