GBE: Add a new pass to handle barrier function's noduplicate attribute correctly.
authorZhigang Gong <zhigang.gong@intel.com>
Wed, 26 Mar 2014 05:45:56 +0000 (13:45 +0800)
committerZhigang Gong <zhigang.gong@intel.com>
Tue, 8 Apr 2014 08:00:49 +0000 (16:00 +0800)
commitd93f4c9d494e16978bdbcdc2525314c13f0b6f2d
tree129120c157ba2191696b5e5d2a9ee6e19f90acab
parent684608ba6459c8a987ead861a7efa22979e79c4c
GBE: Add a new pass to handle barrier function's noduplicate attribute correctly.

This pass is to remove or add noduplicate function attribute for barrier functions.
Basically, we want to set NoDuplicate for those __gen_barrier_xxx functions. But if
a sub function calls those barrier functions, the sub function will not be inlined
in llvm's inlining pass. This is what we don't want. As inlining such a function in
the caller is safe, we just don't want it to duplicate the call. So Introduce this
pass to remove the NoDuplicate function attribute before the inlining pass and restore
it after.

v2:
fix the module changed check.

Signed-off-by: Zhigang Gong <zhigang.gong@intel.com>
Reviewed-by: "Yang, Rong R" <rong.r.yang@intel.com>
Reviewed-by: "Song, Ruiling" <ruiling.song@intel.com>
backend/src/CMakeLists.txt
backend/src/llvm/llvm_barrier_nodup.cpp [new file with mode: 0644]
backend/src/llvm/llvm_gen_backend.hpp
backend/src/llvm/llvm_to_gen.cpp
backend/src/ocl_barrier.ll