summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYang Rong <rong.r.yang@intel.com>2017-10-18 14:57:14 +0800
committerYang Rong <rong.r.yang@intel.com>2017-10-26 13:21:58 +0800
commit8714b107cd8794f0818a281dfc56c0e49af05ba1 (patch)
tree6ec02b707dffaaf30da98e6b1e41a7816b02eb75
parent7f7dca082e9f7c7c610cf934cba0e7d625f98ea0 (diff)
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 <ruiling.song@intel.com> Reviewed-by: Yang Rong <rong.r.yang@intel.com>
-rw-r--r--backend/src/libocl/src/ocl_memcpy.cl3
1 files changed, 2 insertions, 1 deletions
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) { \